summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Accounts/HooksTest.php6
-rw-r--r--tests/lib/Activity/ManagerTest.php21
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleBase.php2
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleFetcherTest.php2
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php15
-rw-r--r--tests/lib/App/AppStore/Fetcher/FetcherBase.php12
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php2
-rw-r--r--tests/lib/AppConfigTest.php2
-rw-r--r--tests/lib/AppFramework/Bootstrap/BootContextTest.php68
-rw-r--r--tests/lib/AppFramework/Bootstrap/CoordinatorTest.php128
-rw-r--r--tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php84
-rw-r--r--tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php162
-rw-r--r--tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php8
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php3
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php6
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIContainerTest.php2
-rw-r--r--tests/lib/AppFramework/Http/DataResponseTest.php1
-rw-r--r--tests/lib/AppFramework/Http/DownloadResponseTest.php4
-rw-r--r--tests/lib/AppFramework/Http/FileDisplayResponseTest.php2
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php28
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php30
-rw-r--r--tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php55
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php6
-rw-r--r--tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php22
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php8
-rw-r--r--tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php26
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php18
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php25
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php9
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php7
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenMapperTest.php8
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php20
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php10
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php16
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php7
-rw-r--r--tests/lib/Avatar/AvatarManagerTest.php14
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php8
-rw-r--r--tests/lib/BackgroundJob/JobListTest.php4
-rw-r--r--tests/lib/Calendar/ManagerTest.php18
-rw-r--r--tests/lib/Collaboration/Collaborators/GroupPluginTest.php64
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php52
-rw-r--r--tests/lib/Collaboration/Collaborators/MailPluginTest.php44
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php28
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchResultTest.php2
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchTest.php48
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php130
-rw-r--r--tests/lib/Command/Integrity/SignAppTest.php16
-rw-r--r--tests/lib/Command/Integrity/SignCoreTest.php12
-rw-r--r--tests/lib/Comments/ManagerTest.php32
-rw-r--r--tests/lib/ConfigTest.php22
-rw-r--r--tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php9
-rw-r--r--tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php33
-rw-r--r--tests/lib/Contacts/ContactsMenu/ManagerTest.php9
-rw-r--r--tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php5
-rw-r--r--tests/lib/ContactsManagerTest.php20
-rw-r--r--tests/lib/DB/DBSchemaTest.php4
-rw-r--r--tests/lib/DB/MDB2SchemaReaderTest.php2
-rw-r--r--tests/lib/DB/MigrationsTest.php4
-rw-r--r--tests/lib/DB/OCPostgreSqlPlatformTest.php6
-rw-r--r--tests/lib/DB/QueryBuilder/QueryBuilderTest.php4
-rw-r--r--tests/lib/DB/schemDiffData/core.xml2
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php22
-rw-r--r--tests/lib/Encryption/EncryptionWrapperTest.php6
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php6
-rw-r--r--tests/lib/Encryption/ManagerTest.php16
-rw-r--r--tests/lib/Encryption/UpdateTest.php14
-rw-r--r--tests/lib/Encryption/UtilTest.php10
-rw-r--r--tests/lib/Files/AppData/AppDataTest.php4
-rw-r--r--tests/lib/Files/AppData/FactoryTest.php4
-rw-r--r--tests/lib/Files/Cache/CacheTest.php2
-rw-r--r--tests/lib/Files/Cache/LocalRootScannerTest.php59
-rw-r--r--tests/lib/Files/Cache/QuerySearchHelperTest.php2
-rw-r--r--tests/lib/Files/Mount/ObjectHomeMountProviderTest.php8
-rw-r--r--tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php113
-rw-r--r--tests/lib/Files/Node/FileTest.php20
-rw-r--r--tests/lib/Files/Node/FolderTest.php60
-rw-r--r--tests/lib/Files/Node/HookConnectorTest.php1
-rw-r--r--tests/lib/Files/Node/NodeTest.php44
-rw-r--r--tests/lib/Files/Node/RootTest.php24
-rw-r--r--tests/lib/Files/SimpleFS/SimpleFileTest.php2
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php34
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php4
-rw-r--r--tests/lib/Files/ViewTest.php46
-rw-r--r--tests/lib/GlobalScale/ConfigTest.php4
-rw-r--r--tests/lib/Group/ManagerTest.php68
-rw-r--r--tests/lib/InstallerTest.php10
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php24
-rw-r--r--tests/lib/L10N/FactoryTest.php12
-rw-r--r--tests/lib/L10N/LanguageIteratorTest.php4
-rw-r--r--tests/lib/Log/LogFactoryTest.php4
-rw-r--r--tests/lib/LoggerTest.php4
-rw-r--r--tests/lib/Mail/EMailTemplateTest.php6
-rw-r--r--tests/lib/Mail/MailerTest.php10
-rw-r--r--tests/lib/Mail/MessageTest.php8
-rw-r--r--tests/lib/Migration/BackgroundRepairTest.php8
-rw-r--r--tests/lib/NavigationManagerTest.php16
-rw-r--r--tests/lib/Notification/ManagerTest.php10
-rw-r--r--tests/lib/Notification/NotificationTest.php28
-rw-r--r--tests/lib/OCS/DiscoveryServiceTest.php4
-rw-r--r--tests/lib/Preview/GeneratorTest.php15
-rw-r--r--tests/lib/Repair/CleanTagsTest.php2
-rw-r--r--tests/lib/Repair/NC11/FixMountStoragesTest.php2
-rw-r--r--tests/lib/Repair/OldGroupMembershipSharesTest.php14
-rw-r--r--tests/lib/Repair/RepairCollationTest.php2
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php10
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php4
-rw-r--r--tests/lib/Repair/RepairSqliteAutoincrementTest.php2
-rw-r--r--tests/lib/Security/Bruteforce/CapabilitiesTest.php4
-rw-r--r--tests/lib/Security/Bruteforce/ThrottlerTest.php4
-rw-r--r--tests/lib/Security/CertificateManagerTest.php4
-rw-r--r--tests/lib/Security/IdentityProof/ManagerTest.php10
-rw-r--r--tests/lib/Security/IdentityProof/SignerTest.php6
-rw-r--r--tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php6
-rw-r--r--tests/lib/Security/RateLimiting/LimiterTest.php12
-rw-r--r--tests/lib/Session/CryptoSessionDataTest.php2
-rw-r--r--tests/lib/Session/CryptoWrappingTest.php4
-rw-r--r--tests/lib/Settings/ManagerTest.php12
-rw-r--r--tests/lib/SetupTest.php18
-rw-r--r--tests/lib/Share/ShareTest.php20
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php299
-rw-r--r--tests/lib/Share20/LegacyHooksTest.php29
-rw-r--r--tests/lib/Share20/ManagerTest.php255
-rw-r--r--tests/lib/Share20/ShareHelperTest.php12
-rw-r--r--tests/lib/Share20/ShareTest.php10
-rw-r--r--tests/lib/Support/CrashReport/RegistryTest.php48
-rw-r--r--tests/lib/Support/Subscription/DummySubscription.php58
-rw-r--r--tests/lib/Support/Subscription/RegistryTest.php27
-rw-r--r--tests/lib/TagsTest.php35
-rw-r--r--tests/lib/Template/CSSResourceLocatorTest.php28
-rw-r--r--tests/lib/Template/IconsCacherTest.php10
-rw-r--r--tests/lib/Template/JSCombinerTest.php12
-rw-r--r--tests/lib/Template/JSResourceLocatorTest.php21
-rw-r--r--tests/lib/Template/ResourceLocatorTest.php15
-rw-r--r--tests/lib/Template/SCSSCacherTest.php20
-rw-r--r--tests/lib/TestCase.php21
-rw-r--r--tests/lib/Traits/ClientServiceTrait.php8
-rw-r--r--tests/lib/Traits/MountProviderTrait.php6
-rw-r--r--tests/lib/Updater/ChangesCheckTest.php6
-rw-r--r--tests/lib/Updater/VersionCheckTest.php4
-rw-r--r--tests/lib/UpdaterTest.php8
-rw-r--r--tests/lib/UrlGeneratorTest.php6
-rw-r--r--tests/lib/User/ManagerTest.php48
-rw-r--r--tests/lib/User/UserTest.php68
-rw-r--r--tests/lib/UtilCheckServerTest.php2
146 files changed, 2058 insertions, 1297 deletions
diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php
index a0360404d72..d24afd475e4 100644
--- a/tests/lib/Accounts/HooksTest.php
+++ b/tests/lib/Accounts/HooksTest.php
@@ -35,13 +35,13 @@ use Test\TestCase;
*/
class HooksTest extends TestCase {
- /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var AccountManager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var AccountManager | \PHPUnit\Framework\MockObject\MockObject */
private $accountManager;
- /** @var Hooks | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var Hooks | \PHPUnit\Framework\MockObject\MockObject */
private $hooks;
protected function setUp(): void {
diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php
index 77c0607916a..2235d63383b 100644
--- a/tests/lib/Activity/ManagerTest.php
+++ b/tests/lib/Activity/ManagerTest.php
@@ -35,13 +35,13 @@ class ManagerTest extends TestCase {
/** @var \OC\Activity\Manager */
private $activityManager;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
protected $request;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $session;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IValidator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IValidator|\PHPUnit\Framework\MockObject\MockObject */
protected $validator;
protected function setUp(): void {
@@ -56,7 +56,8 @@ class ManagerTest extends TestCase {
$this->request,
$this->session,
$this->config,
- $this->validator
+ $this->validator,
+ $this->createMock(IL10N::class)
);
$this->assertSame([], self::invokePrivate($this->activityManager, 'getConsumers'));
@@ -75,7 +76,7 @@ class ManagerTest extends TestCase {
$this->assertNotEmpty($consumers);
}
-
+
public function testGetConsumersInvalidConsumer() {
$this->expectException(\InvalidArgumentException::class);
@@ -164,7 +165,7 @@ class ManagerTest extends TestCase {
->willReturn($mockUser);
}
-
+
public function testPublishExceptionNoApp() {
$this->expectException(\BadMethodCallException::class);
@@ -172,7 +173,7 @@ class ManagerTest extends TestCase {
$this->activityManager->publish($event);
}
-
+
public function testPublishExceptionNoType() {
$this->expectException(\BadMethodCallException::class);
@@ -181,7 +182,7 @@ class ManagerTest extends TestCase {
$this->activityManager->publish($event);
}
-
+
public function testPublishExceptionNoAffectedUser() {
$this->expectException(\BadMethodCallException::class);
@@ -191,7 +192,7 @@ class ManagerTest extends TestCase {
$this->activityManager->publish($event);
}
-
+
public function testPublishExceptionNoSubject() {
$this->expectException(\BadMethodCallException::class);
diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php
index dc7e1920896..a886cf9aec1 100644
--- a/tests/lib/App/AppStore/Bundles/BundleBase.php
+++ b/tests/lib/App/AppStore/Bundles/BundleBase.php
@@ -26,7 +26,7 @@ use OCP\IL10N;
use Test\TestCase;
abstract class BundleBase extends TestCase {
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
protected $l10n;
/** @var Bundle */
protected $bundle;
diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
index 5964220958c..55534cae699 100644
--- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
+++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
@@ -32,7 +32,7 @@ use OCP\IL10N;
use Test\TestCase;
class BundleFetcherTest extends TestCase {
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
/** @var BundleFetcher */
private $bundleFetcher;
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 50b0fd04dfc..a0a03985c29 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -35,21 +35,20 @@ use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\ILogger;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class AppFetcherTest extends TestCase {
- /** @var IAppData|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IClientService|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
protected $clientService;
- /** @var ITimeFactory|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
- /** @var IConfig|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var CompareVersion|PHPUnit_Framework_MockObject_MockObject */
+ /** @var CompareVersion|\PHPUnit\Framework\MockObject\MockObject */
protected $compareVersion;
- /** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var AppFetcher */
protected $fetcher;
@@ -1838,7 +1837,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
protected function setUp(): void {
parent::setUp();
- /** @var Factory|PHPUnit_Framework_MockObject_MockObject $factory */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject $factory */
$factory = $this->createMock(Factory::class);
$this->appData = $this->createMock(AppData::class);
$factory->expects($this->once())
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
index 199bcd4b59b..c3d9ec43cc4 100644
--- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -37,17 +37,17 @@ use OCP\ILogger;
use Test\TestCase;
abstract class FetcherBase extends TestCase {
- /** @var Factory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject */
protected $appDataFactory;
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
protected $clientService;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var Fetcher */
protected $fetcher;
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index a7d42d28baf..1e37948d783 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -17,7 +17,7 @@ use Test\TestCase;
class DependencyAnalyzerTest extends TestCase {
- /** @var Platform|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Platform|\PHPUnit\Framework\MockObject\MockObject */
private $platformMock;
/** @var IL10N */
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php
index 3a4c16b3396..ff23454eb8b 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -308,7 +308,7 @@ class AppConfigTest extends TestCase {
}
public function testGetFilteredValues() {
- /** @var \OC\AppConfig|\PHPUnit_Framework_MockObject_MockObject $config */
+ /** @var \OC\AppConfig|\PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->getMockBuilder(\OC\AppConfig::class)
->setConstructorArgs([\OC::$server->getDatabaseConnection()])
->setMethods(['getValues'])
diff --git a/tests/lib/AppFramework/Bootstrap/BootContextTest.php b/tests/lib/AppFramework/Bootstrap/BootContextTest.php
new file mode 100644
index 00000000000..b566347e3ff
--- /dev/null
+++ b/tests/lib/AppFramework/Bootstrap/BootContextTest.php
@@ -0,0 +1,68 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace lib\AppFramework\Bootstrap;
+
+use OC\AppFramework\Bootstrap\BootContext;
+use OCP\AppFramework\IAppContainer;
+use OCP\IServerContainer;
+use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
+
+class BootContextTest extends TestCase {
+
+ /** @var IAppContainer|MockObject */
+ private $appContainer;
+
+ /** @var BootContext */
+ private $context;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->appContainer = $this->createMock(IAppContainer::class);
+
+ $this->context = new BootContext(
+ $this->appContainer
+ );
+ }
+
+ public function testGetAppContainer(): void {
+ $container = $this->context->getAppContainer();
+
+ $this->assertSame($this->appContainer, $container);
+ }
+
+ public function testGetServerContainer(): void {
+ $serverContainer = $this->createMock(IServerContainer::class);
+ $this->appContainer->method('get')
+ ->with(IServerContainer::class)
+ ->willReturn($serverContainer);
+
+ $container = $this->context->getServerContainer();
+
+ $this->assertSame($serverContainer, $container);
+ }
+}
diff --git a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
new file mode 100644
index 00000000000..1fca34423d5
--- /dev/null
+++ b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
@@ -0,0 +1,128 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace lib\AppFramework\Bootstrap;
+
+use OC\AppFramework\Bootstrap\Coordinator;
+use OC\Support\CrashReport\Registry;
+use OCP\App\IAppManager;
+use OCP\AppFramework\App;
+use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\AppFramework\Bootstrap\IBootstrap;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\AppFramework\QueryException;
+use OCP\Dashboard\IManager;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\ILogger;
+use OCP\IServerContainer;
+use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
+
+class CoordinatorTest extends TestCase {
+
+ /** @var IAppManager|MockObject */
+ private $appManager;
+
+ /** @var IServerContainer|MockObject */
+ private $serverContainer;
+
+ /** @var Registry|MockObject */
+ private $crashReporterRegistry;
+
+ /** @var IManager|MockObject */
+ private $dashboardManager;
+
+ /** @var IEventDispatcher|MockObject */
+ private $eventDispatcher;
+
+ /** @var ILogger|MockObject */
+ private $logger;
+
+ /** @var Coordinator */
+ private $coordinator;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->appManager = $this->createMock(IAppManager::class);
+ $this->serverContainer = $this->createMock(IServerContainer::class);
+ $this->crashReporterRegistry = $this->createMock(Registry::class);
+ $this->dashboardManager = $this->createMock(IManager::class);
+ $this->eventDispatcher = $this->createMock(IEventDispatcher::class);
+ $this->logger = $this->createMock(ILogger::class);
+
+ $this->coordinator = new Coordinator(
+ $this->serverContainer,
+ $this->crashReporterRegistry,
+ $this->dashboardManager,
+ $this->eventDispatcher,
+ $this->logger
+ );
+ }
+
+ public function testBootAppNotLoadable(): void {
+ $appId = 'settings';
+ $this->serverContainer->expects($this->once())
+ ->method('query')
+ ->with(\OCA\Settings\AppInfo\Application::class)
+ ->willThrowException(new QueryException(""));
+ $this->logger->expects($this->once())
+ ->method('logException');
+
+ $this->coordinator->bootApp($appId);
+ }
+
+ public function testBootAppNotBootable(): void {
+ $appId = 'settings';
+ $mockApp = $this->createMock(\OCA\Settings\AppInfo\Application::class);
+ $this->serverContainer->expects($this->once())
+ ->method('query')
+ ->with(\OCA\Settings\AppInfo\Application::class)
+ ->willReturn($mockApp);
+
+ $this->coordinator->bootApp($appId);
+ }
+
+ public function testBootApp(): void {
+ $appId = 'settings';
+ $mockApp = new class extends App implements IBootstrap {
+ public function __construct() {
+ parent::__construct('test', []);
+ }
+
+ public function register(IRegistrationContext $context): void {
+ }
+
+ public function boot(IBootContext $context): void {
+ }
+ };
+ $this->serverContainer->expects($this->once())
+ ->method('query')
+ ->with(\OCA\Settings\AppInfo\Application::class)
+ ->willReturn($mockApp);
+
+ $this->coordinator->bootApp($appId);
+ }
+}
diff --git a/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php b/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php
new file mode 100644
index 00000000000..cd2332b0588
--- /dev/null
+++ b/tests/lib/AppFramework/Bootstrap/FunctionInjectorTest.php
@@ -0,0 +1,84 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace lib\AppFramework\Bootstrap;
+
+use OC\AppFramework\Bootstrap\FunctionInjector;
+use OC\AppFramework\Utility\SimpleContainer;
+use Test\TestCase;
+
+interface Foo {
+}
+
+class FunctionInjectorTest extends TestCase {
+
+ /** @var SimpleContainer */
+ private $container;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->container = new SimpleContainer();
+ }
+
+ public function testInjectFnNotRegistered(): void {
+ $this->expectException(\OCP\AppFramework\QueryException::class);
+
+ (new FunctionInjector($this->container))->injectFn(static function (Foo $p1): void {
+ });
+ }
+
+ public function testInjectFnNotRegisteredButNullable(): void {
+ (new FunctionInjector($this->container))->injectFn(static function (?Foo $p1): void {
+ });
+
+ // Nothing to assert. No errors means everything is fine.
+ $this->addToAssertionCount(1);
+ }
+
+ public function testInjectFnByType(): void {
+ $this->container->registerService(Foo::class, function () {
+ $this->addToAssertionCount(1);
+ return new class implements Foo {
+ };
+ });
+
+ (new FunctionInjector($this->container))->injectFn(static function (Foo $p1): void {
+ });
+
+ // Nothing to assert. No errors means everything is fine.
+ $this->addToAssertionCount(1);
+ }
+
+ public function testInjectFnByName(): void {
+ $this->container->registerParameter('test', 'abc');
+
+ (new FunctionInjector($this->container))->injectFn(static function ($test): void {
+ });
+
+ // Nothing to assert. No errors means everything is fine.
+ $this->addToAssertionCount(1);
+ }
+}
diff --git a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
new file mode 100644
index 00000000000..8441b6e983d
--- /dev/null
+++ b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
@@ -0,0 +1,162 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace lib\AppFramework\Bootstrap;
+
+use OC\AppFramework\Bootstrap\RegistrationContext;
+use OCP\AppFramework\App;
+use OCP\AppFramework\IAppContainer;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\ILogger;
+use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
+
+class RegistrationContextTest extends TestCase {
+
+ /** @var ILogger|MockObject */
+ private $logger;
+
+ /** @var RegistrationContext */
+ private $context;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->logger = $this->createMock(ILogger::class);
+
+ $this->context = new RegistrationContext(
+ $this->logger
+ );
+ }
+
+ public function testRegisterCapability(): void {
+ $app = $this->createMock(App::class);
+ $name = 'abc';
+ $container = $this->createMock(IAppContainer::class);
+ $app->method('getContainer')
+ ->willReturn($container);
+ $container->expects($this->once())
+ ->method('registerCapability')
+ ->with($name);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerCapability($name);
+ $this->context->delegateCapabilityRegistrations([
+ 'myapp' => $app,
+ ]);
+ }
+
+ public function testRegisterEventListener(): void {
+ $event = 'abc';
+ $service = 'def';
+ $dispatcher = $this->createMock(IEventDispatcher::class);
+ $dispatcher->expects($this->once())
+ ->method('addServiceListener')
+ ->with($event, $service, 0);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerEventListener($event, $service);
+ $this->context->delegateEventListenerRegistrations($dispatcher);
+ }
+
+ public function testRegisterService(): void {
+ $app = $this->createMock(App::class);
+ $service = 'abc';
+ $factory = function () {
+ return 'def';
+ };
+ $container = $this->createMock(IAppContainer::class);
+ $app->method('getContainer')
+ ->willReturn($container);
+ $container->expects($this->once())
+ ->method('registerService')
+ ->with($service, $factory, true);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerService($service, $factory);
+ $this->context->delegateContainerRegistrations([
+ 'myapp' => $app,
+ ]);
+ }
+
+ public function testRegisterServiceAlias(): void {
+ $app = $this->createMock(App::class);
+ $alias = 'abc';
+ $target = 'def';
+ $container = $this->createMock(IAppContainer::class);
+ $app->method('getContainer')
+ ->willReturn($container);
+ $container->expects($this->once())
+ ->method('registerAlias')
+ ->with($alias, $target);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerServiceAlias($alias, $target);
+ $this->context->delegateContainerRegistrations([
+ 'myapp' => $app,
+ ]);
+ }
+
+ public function testRegisterParameter(): void {
+ $app = $this->createMock(App::class);
+ $name = 'abc';
+ $value = 'def';
+ $container = $this->createMock(IAppContainer::class);
+ $app->method('getContainer')
+ ->willReturn($container);
+ $container->expects($this->once())
+ ->method('registerParameter')
+ ->with($name, $value);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerParameter($name, $value);
+ $this->context->delegateContainerRegistrations([
+ 'myapp' => $app,
+ ]);
+ }
+
+ public function testRegisterMiddleware(): void {
+ $app = $this->createMock(App::class);
+ $name = 'abc';
+ $container = $this->createMock(IAppContainer::class);
+ $app->method('getContainer')
+ ->willReturn($container);
+ $container->expects($this->once())
+ ->method('registerMiddleware')
+ ->with($name);
+ $this->logger->expects($this->never())
+ ->method('logException');
+
+ $this->context->for('myapp')->registerMiddleware($name);
+ $this->context->delegateMiddlewareRegistrations([
+ 'myapp' => $app,
+ ]);
+ }
+}
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index 4c79adcb4a7..c0aea813243 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -32,14 +32,14 @@ use OCP\IURLGenerator;
class AuthPublicShareControllerTest extends \Test\TestCase {
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var ISession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
- /** @var AuthPublicShareController|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var AuthPublicShareController|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index e07089e0c82..7c5b1931512 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -92,7 +92,7 @@ class ControllerTest extends \Test\TestCase {
$this->controller = new ChildController($this->app, $request);
}
-
+
public function testFormatResonseInvalidFormat() {
$this->expectException(\DomainException::class);
@@ -114,6 +114,7 @@ class ControllerTest extends \Test\TestCase {
'Content-Type' => 'application/json; charset=utf-8',
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self'",
'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'",
+ 'X-Robots-Tag' => 'none',
];
$response = $this->controller->customDataResponse(['hi']);
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index 521c45e47c6..f2a60a574af 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -29,12 +29,12 @@ use OCP\ISession;
class PublicShareControllerTest extends \Test\TestCase {
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var ISession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var PublicShareController|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var PublicShareController|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
index ba114433a4c..3004123b81b 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
@@ -37,7 +37,7 @@ use OCP\Security\ISecureRandom;
*/
class DIContainerTest extends \Test\TestCase {
- /** @var DIContainer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var DIContainer|\PHPUnit\Framework\MockObject\MockObject */
private $container;
protected function setUp(): void {
diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php
index e7624c92d7e..a02cee67d31 100644
--- a/tests/lib/AppFramework/Http/DataResponseTest.php
+++ b/tests/lib/AppFramework/Http/DataResponseTest.php
@@ -67,6 +67,7 @@ class DataResponseTest extends \Test\TestCase {
'Cache-Control' => 'no-cache, no-store, must-revalidate',
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self'",
'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'",
+ 'X-Robots-Tag' => 'none',
];
$expectedHeaders = array_merge($expectedHeaders, $headers);
diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php
index 1ad53f5db13..6c509b8bc59 100644
--- a/tests/lib/AppFramework/Http/DownloadResponseTest.php
+++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php
@@ -45,7 +45,7 @@ class DownloadResponseTest extends \Test\TestCase {
public function testHeaders() {
$headers = $this->response->getHeaders();
- $this->assertContains('attachment; filename="file"', $headers['Content-Disposition']);
- $this->assertContains('content', $headers['Content-Type']);
+ $this->assertStringContainsString('attachment; filename="file"', $headers['Content-Disposition']);
+ $this->assertStringContainsString('content', $headers['Content-Type']);
}
}
diff --git a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
index 5ca7635614c..0a244a85754 100644
--- a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
+++ b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
@@ -28,7 +28,7 @@ use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\Files\File;
class FileDisplayResponseTest extends \Test\TestCase {
- /** @var File|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var File|\PHPUnit\Framework\MockObject\MockObject */
private $file;
/** @var FileDisplayResponse */
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index a8e2f2248c6..7260b31b27e 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -632,6 +632,34 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('192.168.3.99', $request->getRemoteAddress());
}
+ public function testGetRemoteAddressWithXForwardedForIPv6() {
+ $this->config
+ ->expects($this->at(0))
+ ->method('getSystemValue')
+ ->with('trusted_proxies')
+ ->willReturn(['192.168.2.0/24']);
+ $this->config
+ ->expects($this->at(1))
+ ->method('getSystemValue')
+ ->with('forwarded_for_headers')
+ ->willReturn(['HTTP_X_FORWARDED_FOR']);
+
+ $request = new Request(
+ [
+ 'server' => [
+ 'REMOTE_ADDR' => '192.168.2.99',
+ 'HTTP_X_FORWARDED_FOR' => '[2001:db8:85a3:8d3:1319:8a2e:370:7348]',
+ ],
+ ],
+ $this->secureRandom,
+ $this->config,
+ $this->csrfTokenManager,
+ $this->stream
+ );
+
+ $this->assertSame('2001:db8:85a3:8d3:1319:8a2e:370:7348', $request->getRemoteAddress());
+ }
+
/**
* @return array
*/
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index f33d0a0089d..7a064908869 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -51,7 +51,8 @@ class ResponseTest extends \Test\TestCase {
$expected = [
'Last-Modified' => 1,
'ETag' => 3,
- 'Something-Else' => 'hi'
+ 'Something-Else' => 'hi',
+ 'X-Robots-Tag' => 'none',
];
$this->childResponse->setHeaders($expected);
@@ -90,7 +91,7 @@ class ResponseTest extends \Test\TestCase {
public function testAddHeaderValueNullDeletesIt() {
$this->childResponse->addHeader('hello', 'world');
$this->childResponse->addHeader('hello', null);
- $this->assertEquals(3, count($this->childResponse->getHeaders()));
+ $this->assertEquals(4, count($this->childResponse->getHeaders()));
}
@@ -108,10 +109,12 @@ class ResponseTest extends \Test\TestCase {
'foo' => [
'value' => 'bar',
'expireDate' => null,
+ 'sameSite' => 'Lax',
],
'bar' => [
'value' => 'foo',
- 'expireDate' => new \DateTime('1970-01-01')
+ 'expireDate' => new \DateTime('1970-01-01'),
+ 'sameSite' => 'Lax',
]
];
$this->assertEquals($expectedResponse, $this->childResponse->getCookies());
@@ -143,7 +146,8 @@ class ResponseTest extends \Test\TestCase {
$expected = [
'foo' => [
'value' => 'expired',
- 'expireDate' => new \DateTime('1971-01-01')
+ 'expireDate' => new \DateTime('1971-01-01'),
+ 'sameSite' => 'Lax',
]
];
@@ -159,11 +163,13 @@ class ResponseTest extends \Test\TestCase {
$expected = [
'foo' => [
'value' => 'bar',
- 'expireDate' => null
+ 'expireDate' => null,
+ 'sameSite' => 'Lax',
],
'bar' => [
'value' => 'foo',
- 'expireDate' => null
+ 'expireDate' => null,
+ 'sameSite' => 'Lax',
]
];
$cookies = $this->childResponse->getCookies();
@@ -173,11 +179,13 @@ class ResponseTest extends \Test\TestCase {
$expected = [
'foo' => [
'value' => 'expired',
- 'expireDate' => new \DateTime('1971-01-01')
+ 'expireDate' => new \DateTime('1971-01-01'),
+ 'sameSite' => 'Lax',
],
'bar' => [
'value' => 'expired',
- 'expireDate' => new \DateTime('1971-01-01')
+ 'expireDate' => new \DateTime('1971-01-01'),
+ 'sameSite' => 'Lax',
]
];
@@ -229,15 +237,15 @@ class ResponseTest extends \Test\TestCase {
public function testCacheSeconds() {
$time = $this->createMock(ITimeFactory::class);
$time->method('getTime')
- ->willReturn('1234567');
+ ->willReturn(1234567);
$this->overwriteService(ITimeFactory::class, $time);
$this->childResponse->cacheFor(33);
$headers = $this->childResponse->getHeaders();
- $this->assertEquals('max-age=33, must-revalidate', $headers['Cache-Control']);
- $this->assertEquals('public', $headers['Pragma']);
+ $this->assertEquals('private, max-age=33, must-revalidate', $headers['Cache-Control']);
+ $this->assertEquals('private', $headers['Pragma']);
$this->assertEquals('Thu, 15 Jan 1970 06:56:40 +0000', $headers['Expires']);
}
diff --git a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
index 617ead473c0..5127248215b 100644
--- a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
@@ -27,10 +27,12 @@ namespace Test\AppFramework\Middleware;
use OC\AppFramework\Middleware\AdditionalScriptsMiddleware;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\PublicShareController;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -38,7 +40,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
/** @var EventDispatcherInterface|MockObject */
- private $dispatcher;
+ private $legacyDispatcher;
/** @var IUserSession|MockObject */
private $userSession;
@@ -47,40 +49,48 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
/** @var AdditionalScriptsMiddleware */
private $middleWare;
+ /** @var IEventDispatcher|MockObject */
+ private $dispatcher;
protected function setUp(): void {
parent::setUp();
- $this->dispatcher = $this->createMock(EventDispatcherInterface::class);
+ $this->legacyDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->userSession = $this->createMock(IUserSession::class);
+ $this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->middleWare = new AdditionalScriptsMiddleware(
- $this->dispatcher,
- $this->userSession
+ $this->legacyDispatcher,
+ $this->userSession,
+ $this->dispatcher
);
$this->controller = $this->createMock(Controller::class);
}
public function testNoTemplateResponse() {
- $this->dispatcher->expects($this->never())
+ $this->legacyDispatcher->expects($this->never())
->method($this->anything());
$this->userSession->expects($this->never())
->method($this->anything());
+ $this->dispatcher->expects($this->never())
+ ->method($this->anything());
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(Response::class));
}
public function testPublicShareController() {
- $this->dispatcher->expects($this->never())
+ $this->legacyDispatcher->expects($this->never())
->method($this->anything());
$this->userSession->expects($this->never())
->method($this->anything());
+ $this->dispatcher->expects($this->never())
+ ->method($this->anything());
$this->middleWare->afterController($this->createMock(PublicShareController::class), 'myMethod', $this->createMock(Response::class));
}
public function testStandaloneTemplateResponse() {
- $this->dispatcher->expects($this->once())
+ $this->legacyDispatcher->expects($this->once())
->method('dispatch')
->willReturnCallback(function ($eventName) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS) {
@@ -91,12 +101,21 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
});
$this->userSession->expects($this->never())
->method($this->anything());
+ $this->dispatcher->expects($this->once())
+ ->method('dispatchTyped')
+ ->willReturnCallback(function ($event) {
+ if ($event instanceof BeforeTemplateRenderedEvent && $event->isLoggedIn() === false) {
+ return;
+ }
+
+ $this->fail('Wrong event dispatched');
+ });
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(StandaloneTemplateResponse::class));
}
public function testTemplateResponseNotLoggedIn() {
- $this->dispatcher->expects($this->once())
+ $this->legacyDispatcher->expects($this->once())
->method('dispatch')
->willReturnCallback(function ($eventName) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS) {
@@ -107,6 +126,15 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
});
$this->userSession->method('isLoggedIn')
->willReturn(false);
+ $this->dispatcher->expects($this->once())
+ ->method('dispatchTyped')
+ ->willReturnCallback(function ($event) {
+ if ($event instanceof BeforeTemplateRenderedEvent && $event->isLoggedIn() === false) {
+ return;
+ }
+
+ $this->fail('Wrong event dispatched');
+ });
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(TemplateResponse::class));
}
@@ -114,7 +142,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
public function testTemplateResponseLoggedIn() {
$events = [];
- $this->dispatcher->expects($this->exactly(2))
+ $this->legacyDispatcher->expects($this->exactly(2))
->method('dispatch')
->willReturnCallback(function ($eventName) use (&$events) {
if ($eventName === TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS ||
@@ -127,6 +155,15 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
});
$this->userSession->method('isLoggedIn')
->willReturn(true);
+ $this->dispatcher->expects($this->once())
+ ->method('dispatchTyped')
+ ->willReturnCallback(function ($event) {
+ if ($event instanceof BeforeTemplateRenderedEvent && $event->isLoggedIn() === true) {
+ return;
+ }
+
+ $this->fail('Wrong event dispatched');
+ });
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(TemplateResponse::class));
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index ed6d06d4bf5..7e7140971e4 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -38,11 +38,11 @@ use OCP\IURLGenerator;
class PublicShareMiddlewareTest extends \Test\TestCase {
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var ISession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
/** @var PublicShareMiddleware */
diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php
index 55c874ccdb5..f8db85a9358 100644
--- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php
@@ -30,11 +30,11 @@ use OCP\IRequest;
use Test\TestCase;
class BruteForceMiddlewareTest extends TestCase {
- /** @var ControllerMethodReflector|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ControllerMethodReflector|\PHPUnit\Framework\MockObject\MockObject */
private $reflector;
- /** @var Throttler|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */
private $throttler;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
/** @var BruteForceMiddleware */
private $bruteForceMiddleware;
@@ -73,7 +73,7 @@ class BruteForceMiddlewareTest extends TestCase {
->method('sleepDelay')
->with('127.0.0.1', 'login');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->bruteForceMiddleware->beforeController($controller, 'testMethod');
}
@@ -94,13 +94,13 @@ class BruteForceMiddlewareTest extends TestCase {
->expects($this->never())
->method('sleepDelay');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->bruteForceMiddleware->beforeController($controller, 'testMethod');
}
public function testAfterControllerWithAnnotationAndThrottledRequest() {
- /** @var Response|\PHPUnit_Framework_MockObject_MockObject $response */
+ /** @var Response|\PHPUnit\Framework\MockObject\MockObject $response */
$response = $this->createMock(Response::class);
$this->reflector
->expects($this->once())
@@ -133,13 +133,13 @@ class BruteForceMiddlewareTest extends TestCase {
->method('registerAttempt')
->with('login', '127.0.0.1');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response);
}
public function testAfterControllerWithAnnotationAndNotThrottledRequest() {
- /** @var Response|\PHPUnit_Framework_MockObject_MockObject $response */
+ /** @var Response|\PHPUnit\Framework\MockObject\MockObject $response */
$response = $this->createMock(Response::class);
$this->reflector
->expects($this->once())
@@ -163,7 +163,7 @@ class BruteForceMiddlewareTest extends TestCase {
->expects($this->never())
->method('registerAttempt');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response);
}
@@ -184,9 +184,9 @@ class BruteForceMiddlewareTest extends TestCase {
->expects($this->never())
->method('sleepDelay');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
- /** @var Response|\PHPUnit_Framework_MockObject_MockObject $response */
+ /** @var Response|\PHPUnit\Framework\MockObject\MockObject $response */
$response = $this->createMock(Response::class);
$this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response);
}
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index a7bf2b14271..4853b527bf3 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -27,7 +27,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
/** @var ControllerMethodReflector */
private $reflector;
- /** @var Session|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Session|\PHPUnit\Framework\MockObject\MockObject */
private $session;
/** @var Throttler */
private $throttler;
@@ -254,7 +254,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->assertEquals($expected, $response);
}
-
+
public function testAfterExceptionWithRegularException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('A regular exception');
diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
index 7a64b6cbcad..3153d7f0b08 100644
--- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
@@ -36,17 +36,17 @@ use Test\TestCase;
class PasswordConfirmationMiddlewareTest extends TestCase {
/** @var ControllerMethodReflector */
private $reflector;
- /** @var ISession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
private $userSession;
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
private $user;
/** @var PasswordConfirmationMiddleware */
private $middleware;
/** @var Controller */
private $contoller;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
protected function setUp(): void {
diff --git a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
index 3a06531eefd..0d27a9a070f 100644
--- a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php
@@ -34,13 +34,13 @@ use OCP\IUserSession;
use Test\TestCase;
class RateLimitingMiddlewareTest extends TestCase {
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
private $userSession;
- /** @var ControllerMethodReflector|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ControllerMethodReflector|\PHPUnit\Framework\MockObject\MockObject */
private $reflector;
- /** @var Limiter|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Limiter|\PHPUnit\Framework\MockObject\MockObject */
private $limiter;
/** @var RateLimitingMiddleware */
private $rateLimitingMiddleware;
@@ -90,13 +90,13 @@ class RateLimitingMiddlewareTest extends TestCase {
->expects($this->never())
->method('registerAnonRequest');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->rateLimitingMiddleware->beforeController($controller, 'testMethod');
}
public function testBeforeControllerForAnon() {
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->request
->expects($this->once())
@@ -137,9 +137,9 @@ class RateLimitingMiddlewareTest extends TestCase {
}
public function testBeforeControllerForLoggedIn() {
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->userSession
@@ -185,7 +185,7 @@ class RateLimitingMiddlewareTest extends TestCase {
}
public function testBeforeControllerAnonWithFallback() {
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->request
->expects($this->once())
@@ -229,19 +229,19 @@ class RateLimitingMiddlewareTest extends TestCase {
$this->rateLimitingMiddleware->beforeController($controller, 'testMethod');
}
-
+
public function testAfterExceptionWithOtherException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('My test exception');
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->rateLimitingMiddleware->afterException($controller, 'testMethod', new \Exception('My test exception'));
}
public function testAfterExceptionWithJsonBody() {
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->request
->expects($this->once())
@@ -260,7 +260,7 @@ class RateLimitingMiddlewareTest extends TestCase {
}
public function testAfterExceptionWithHtmlBody() {
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject $controller */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */
$controller = $this->createMock(Controller::class);
$this->request
->expects($this->once())
diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
index 6f3c3f32adc..61f5eeb5aea 100644
--- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
@@ -37,10 +37,10 @@ class SameSiteCookieMiddlewareTest extends TestCase {
/** @var SameSiteCookieMiddleware */
private $middleware;
- /** @var Request|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Request|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var ControllerMethodReflector|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ControllerMethodReflector|\PHPUnit\Framework\MockObject\MockObject */
private $reflector;
protected function setUp(): void {
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index 306ee9f841c..680c3937836 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -47,27 +47,27 @@ use OCP\Security\ISecureRandom;
class SecurityMiddlewareTest extends \Test\TestCase {
- /** @var SecurityMiddleware|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SecurityMiddleware|\PHPUnit\Framework\MockObject\MockObject */
private $middleware;
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
/** @var SecurityException */
private $secException;
/** @var SecurityException */
private $secAjaxException;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
/** @var ControllerMethodReflector */
private $reader;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var INavigationManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var INavigationManager|\PHPUnit\Framework\MockObject\MockObject */
private $navigationManager;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
- /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
protected function setUp(): void {
@@ -535,7 +535,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
new StrictCookieMissingException()
);
- $expected = new RedirectResponse(\OC::$WEBROOT);
+ $expected = new RedirectResponse(\OC::$WEBROOT . '/');
$this->assertEquals($expected , $response);
}
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index 34aaff82310..4712d2f30eb 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -3,7 +3,6 @@
namespace Test\AppFramework\Routing;
use OC\AppFramework\DependencyInjection\DIContainer;
-use OC\AppFramework\Routing\RouteActionHandler;
use OC\AppFramework\Routing\RouteConfig;
use OC\Route\Route;
use OC\Route\Router;
@@ -420,7 +419,7 @@ class RoutingTest extends \Test\TestCase {
array $defaults=[]
) {
$route = $this->getMockBuilder(Route::class)
- ->onlyMethods(['method', 'action', 'requirements', 'defaults'])
+ ->onlyMethods(['method', 'requirements', 'defaults'])
->disableOriginalConstructor()
->getMock();
$route
@@ -429,12 +428,6 @@ class RoutingTest extends \Test\TestCase {
->with($this->equalTo($verb))
->willReturn($route);
- $route
- ->expects($this->once())
- ->method('action')
- ->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName)))
- ->willReturn($route);
-
if (count($requirements) > 0) {
$route
->expects($this->once())
@@ -443,13 +436,15 @@ class RoutingTest extends \Test\TestCase {
->willReturn($route);
}
- if (count($defaults) > 0) {
- $route
- ->expects($this->once())
- ->method('defaults')
- ->with($this->equalTo($defaults))
- ->willReturn($route);
- }
+ $route->expects($this->once())
+ ->method('defaults')
+ ->with($this->callback(function (array $def) use ($defaults, $controllerName, $actionName) {
+ $defaults['caller'] = ['app1', $controllerName, $actionName];
+
+ $this->assertEquals($defaults, $def);
+ return true;
+ }))
+ ->willReturn($route);
return $route;
}
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index f8a43058305..36fa1febfcf 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* ownCloud - App Framework
*
@@ -67,13 +69,14 @@ class SimpleContainerTest extends \Test\TestCase {
}
+
public function testRegister() {
$this->container->registerParameter('test', 'abc');
$this->assertEquals('abc', $this->container->query('test'));
}
-
+
public function testNothingRegistered() {
$this->expectException(\OCP\AppFramework\QueryException::class);
@@ -81,7 +84,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
-
+
public function testNotAClass() {
$this->expectException(\OCP\AppFramework\QueryException::class);
@@ -190,7 +193,7 @@ class SimpleContainerTest extends \Test\TestCase {
$this->assertEquals('abc', $this->container->query($query));
}
-
+
public function testConstructorComplexNoTestParameterFound() {
$this->expectException(\OCP\AppFramework\QueryException::class);
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index e7b9cb5996f..ea490b76b8a 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -34,18 +34,17 @@ use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\ILogger;
use OCP\ISession;
use OCP\Session\Exceptions\SessionNotAvailableException;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class StoreTest extends TestCase {
- /** @var ISession|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var IProvider|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var Store */
diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
index 855e90ab6b9..6fdf5b9060e 100644
--- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
@@ -145,7 +145,7 @@ class DefaultTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetInvalidToken() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -175,14 +175,14 @@ class DefaultTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetTokenByIdNotFound() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
-
+
public function testGetInvalidTokenById() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -200,7 +200,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testDeleteById() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('id')
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index d95e4c0418d..00b7f0dee03 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -38,17 +38,17 @@ use Test\TestCase;
class DefaultTokenProviderTest extends TestCase {
- /** @var DefaultTokenProvider|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var DefaultTokenProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var DefaultTokenMapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var DefaultTokenMapper|\PHPUnit\Framework\MockObject\MockObject */
private $mapper;
- /** @var ICrypto|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */
private $crypto;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
/** @var int */
private $time;
@@ -131,7 +131,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->tokenProvider->updateTokenActivity($tk);
}
-
+
public function testGetTokenByUser() {
$this->mapper->expects($this->once())
->method('getTokenByUser')
@@ -159,7 +159,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->assertEquals('passme', $actual);
}
-
+
public function testGetPasswordPasswordLessToken() {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
@@ -170,7 +170,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($tk, $token);
}
-
+
public function testGetPasswordDeletesInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
@@ -222,7 +222,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->assertEquals('encryptedpassword', $token->getPassword());
}
-
+
public function testSetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
index 5ba7fe7c40e..2f2af38851d 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
@@ -172,7 +172,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetInvalidToken() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -204,14 +204,14 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetTokenByIdNotFound() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
-
+
public function testGetInvalidTokenById() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -229,7 +229,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
public function testDeleteById() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('id')
@@ -243,7 +243,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
public function testDeleteByIdWrongUser() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$id = 33;
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 43ae0e9542c..c16ee7b818e 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -39,17 +39,17 @@ use Test\TestCase;
class PublicKeyTokenProviderTest extends TestCase {
- /** @var PublicKeyTokenProvider|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var PublicKeyTokenProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var PublicKeyTokenMapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var PublicKeyTokenMapper|\PHPUnit\Framework\MockObject\MockObject */
private $mapper;
/** @var ICrypto */
private $crypto;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
/** @var int */
private $time;
@@ -145,7 +145,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
}
-
+
public function testGetPasswordPasswordLessToken() {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
@@ -156,7 +156,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($tk, $token);
}
-
+
public function testGetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
@@ -205,7 +205,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($newpass, $this->tokenProvider->getPassword($actual, 'token'));
}
-
+
public function testSetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
index b77bddcd5a4..378376a41f9 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
@@ -29,15 +29,14 @@ namespace lib\Authentication\TwoFactorAuth;
use OC\Authentication\TwoFactorAuth\ProviderLoader;
use OCP\App\IAppManager;
use OCP\Authentication\TwoFactorAuth\IProvider;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class ProviderLoaderTest extends TestCase {
- /** @var IAppManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IUser|\PHPUnit\Framework\MockObject\MockObject */
private $user;
/** @var ProviderLoader */
@@ -52,7 +51,7 @@ class ProviderLoaderTest extends TestCase {
$this->loader = new ProviderLoader($this->appManager);
}
-
+
public function testFailHardIfProviderCanNotBeLoaded() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Could not load two-factor auth provider \\OCA\\MyFaulty2faApp\\DoesNotExist');
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php
index 5351a1069fc..5a061cd10e9 100644
--- a/tests/lib/Avatar/AvatarManagerTest.php
+++ b/tests/lib/Avatar/AvatarManagerTest.php
@@ -38,17 +38,17 @@ use OCP\IUser;
* Class AvatarManagerTest
*/
class AvatarManagerTest extends \Test\TestCase {
- /** @var Manager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */
private $userManager;
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
private $appData;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var AvatarManager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var AvatarManager | \PHPUnit\Framework\MockObject\MockObject */
private $avatarManager;
protected function setUp(): void {
@@ -69,7 +69,7 @@ class AvatarManagerTest extends \Test\TestCase {
);
}
-
+
public function testGetAvatarInvalidUser() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('user does not exist');
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index e3e0bd1d64e..cf0edad9502 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -19,16 +19,16 @@ use OCP\IL10N;
use OCP\ILogger;
class UserAvatarTest extends \Test\TestCase {
- /** @var Folder | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var Folder | \PHPUnit\Framework\MockObject\MockObject */
private $folder;
/** @var \OC\Avatar\UserAvatar */
private $avatar;
- /** @var \OC\User\User | \PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var \OC\User\User | \PHPUnit\Framework\MockObject\MockObject $user */
private $user;
- /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -278,7 +278,7 @@ class UserAvatarTest extends \Test\TestCase {
}
private function getUserAvatar($user) {
- /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */
+ /** @var \OCP\IL10N | \PHPUnit\Framework\MockObject\MockObject $l */
$l = $this->createMock(IL10N::class);
$l->method('t')->willReturnArgument(0);
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 3013afdfa1d..20ba1e50016 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -27,10 +27,10 @@ class JobListTest extends TestCase {
/** @var \OCP\IDBConnection */
protected $connection;
- /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var \OCP\AppFramework\Utility\ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\AppFramework\Utility\ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
protected function setUp(): void {
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index 3a2c10b6d62..e686e82adf0 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -42,7 +42,7 @@ class ManagerTest extends TestCase {
* @dataProvider searchProvider
*/
public function testSearch($search1, $search2, $expected) {
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
@@ -50,7 +50,7 @@ class ManagerTest extends TestCase {
->with('', [], [], null, null)
->willReturn($search1);
- /** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
@@ -69,7 +69,7 @@ class ManagerTest extends TestCase {
* @dataProvider searchProvider
*/
public function testSearchOptions($search1, $search2, $expected) {
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
@@ -78,7 +78,7 @@ class ManagerTest extends TestCase {
['timerange' => ['start' => null, 'end' => null]], 5, 20)
->willReturn($search1);
- /** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
@@ -150,11 +150,11 @@ class ManagerTest extends TestCase {
}
public function testRegisterUnregister() {
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('key2');
@@ -174,11 +174,11 @@ class ManagerTest extends TestCase {
}
public function testGetCalendars() {
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
$calendar2->method('getKey')->willReturn('key2');
@@ -203,7 +203,7 @@ class ManagerTest extends TestCase {
}
public function testIfEnabledIfSo() {
- /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar */
+ /** @var ICalendar | \PHPUnit\Framework\MockObject\MockObject $calendar */
$calendar = $this->createMock(ICalendar::class);
$this->manager->registerCalendar($calendar);
diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
index 909a11596a3..2f7cd1061e9 100644
--- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
@@ -31,17 +31,17 @@ use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class GroupPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $session;
/** @var ISearchResult */
@@ -56,7 +56,7 @@ class GroupPluginTest extends TestCase {
/** @var int */
protected $offset = 0;
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
protected function setUp(): void {
@@ -101,7 +101,7 @@ class GroupPluginTest extends TestCase {
* @param string $gid
* @param null $displayName
* @param bool $hide
- * @return IGroup|\PHPUnit_Framework_MockObject_MockObject
+ * @return IGroup|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getGroupMock($gid, $displayName = null, $hide = false) {
$group = $this->createMock(IGroup::class);
@@ -135,7 +135,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1')],
[],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -145,7 +145,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1', 'Test One')],
[],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -155,7 +155,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1', 'Test One')],
[],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -164,7 +164,7 @@ class GroupPluginTest extends TestCase {
'Test One', false, true,
[$this->getGroupMock('test1', 'Test One')],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
[],
true,
false,
@@ -185,8 +185,8 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -197,7 +197,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -211,8 +211,8 @@ class GroupPluginTest extends TestCase {
[],
[],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
null,
@@ -237,11 +237,11 @@ class GroupPluginTest extends TestCase {
],
[],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
$this->getGroupMock('test'),
@@ -254,7 +254,7 @@ class GroupPluginTest extends TestCase {
],
[],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[],
true,
@@ -270,7 +270,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test1')],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -293,7 +293,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
false,
false,
@@ -305,7 +305,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -318,7 +318,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test1')],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -341,8 +341,8 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -353,7 +353,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -367,8 +367,8 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
null,
@@ -393,11 +393,11 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
$this->getGroupMock('test'),
@@ -410,7 +410,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[],
true,
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index eb26443a269..0a1febe33a5 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -36,22 +36,22 @@ use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class LookupPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
protected $clientService;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
- /** @var ICloudIdManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
protected $cloudIdManager;
/** @var LookupPlugin */
protected $plugin;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
protected function setUp(): void {
@@ -108,7 +108,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
- /** @var ISearchResult|\PHPUnit_Framework_MockObject_MockObject $searchResult */
+ /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@@ -132,7 +132,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
- /** @var ISearchResult|\PHPUnit_Framework_MockObject_MockObject $searchResult */
+ /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@@ -145,7 +145,7 @@ class LookupPluginTest extends TestCase {
public function testSearch(array $searchParams) {
$type = new SearchResultType('lookup');
- /** @var ISearchResult|\PHPUnit_Framework_MockObject_MockObject $searchResult */
+ /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->once())
->method('addResultSet')
@@ -207,7 +207,7 @@ class LookupPluginTest extends TestCase {
public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled) {
$type = new SearchResultType('lookup');
- /** @var ISearchResult|\PHPUnit_Framework_MockObject_MockObject $searchResult */
+ /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->config->expects($this->once())
@@ -269,7 +269,7 @@ class LookupPluginTest extends TestCase {
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('no');
- /** @var ISearchResult|\PHPUnit_Framework_MockObject_MockObject $searchResult */
+ /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->never())
->method('addResultSet');
@@ -301,7 +301,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -309,7 +309,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -317,7 +317,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -340,7 +340,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -348,7 +348,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -356,7 +356,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -379,7 +379,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -387,7 +387,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -395,7 +395,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -418,7 +418,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -426,7 +426,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -434,7 +434,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -469,7 +469,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -477,7 +477,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -485,7 +485,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
index 613208d27b1..54dec490a2d 100644
--- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
@@ -33,17 +33,17 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class MailPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
protected $contactsManager;
- /** @var ICloudIdManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
protected $cloudIdManager;
/** @var MailPlugin */
@@ -52,10 +52,10 @@ class MailPluginTest extends TestCase {
/** @var SearchResult */
protected $searchResult;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
protected function setUp(): void {
@@ -126,7 +126,7 @@ class MailPluginTest extends TestCase {
'test@remote.com',
[],
true,
- ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -144,7 +144,7 @@ class MailPluginTest extends TestCase {
'test@remote.com',
[],
false,
- ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -171,7 +171,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
+ ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
false,
false,
],
@@ -225,7 +225,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -252,7 +252,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -279,7 +279,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
true,
false,
],
@@ -306,7 +306,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
true,
false,
],
@@ -334,7 +334,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User Name @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User Name @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
true,
false,
],
@@ -380,7 +380,7 @@ class MailPluginTest extends TestCase {
]
],
false,
- ['users' => [], 'exact' => ['users' => [['uuid' => 'uid1', 'name' => 'User', 'label' => 'User (test@example.com)','value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test'],]]]],
+ ['users' => [], 'exact' => ['users' => [['uuid' => 'uid1', 'name' => 'User', 'label' => 'User (test@example.com)','value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'],]]]],
true,
false,
],
@@ -438,8 +438,8 @@ class MailPluginTest extends TestCase {
],
true,
['users' => [
- ['uuid' => 'uid1', 'name' => 'User1', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['uuid' => 'uid2', 'name' => 'User2', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['uuid' => 'uid1', 'name' => 'User1', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['uuid' => 'uid2', 'name' => 'User2', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
], 'emails' => [], 'exact' => ['users' => [], 'emails' => []]],
false,
true,
@@ -476,8 +476,8 @@ class MailPluginTest extends TestCase {
],
true,
['emails' => [
- ['uuid' => 'uid1', 'name' => 'User1', 'type' => '', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@example.com']],
- ['uuid' => 'uid2', 'name' => 'User2', 'type' => '', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@example.de']],
+ ['uuid' => 'uid1', 'name' => 'User1', 'type' => '', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@example.com']],
+ ['uuid' => 'uid2', 'name' => 'User2', 'type' => '', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@example.de']],
], 'exact' => ['emails' => []]],
false,
true,
@@ -509,8 +509,8 @@ class MailPluginTest extends TestCase {
false,
['emails' => [
], 'exact' => ['emails' => [
- ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'HOME', 'label' => 'User Name (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']],
- ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'WORK', 'label' => 'User Name (username@other)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@other']]
+ ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'HOME', 'label' => 'User Name (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']],
+ ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'WORK', 'label' => 'User Name (username@other)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@other']]
]]],
false,
false,
@@ -544,7 +544,7 @@ class MailPluginTest extends TestCase {
$this->instantiatePlugin();
- /** @var \OCP\IUser | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IUser | \PHPUnit\Framework\MockObject\MockObject */
$currentUser = $this->createMock('\OCP\IUser');
$currentUser->expects($this->any())
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
index a651d4ec1d4..c03f993508b 100644
--- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
@@ -33,21 +33,21 @@ use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class RemotePluginTest extends TestCase {
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
protected $contactsManager;
- /** @var ICloudIdManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
protected $cloudIdManager;
/** @var RemotePlugin */
@@ -150,7 +150,7 @@ class RemotePluginTest extends TestCase {
'test@remote',
[],
true,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -158,7 +158,7 @@ class RemotePluginTest extends TestCase {
'test@remote',
[],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -184,7 +184,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => []]],
+ ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => []]],
false,
true,
],
@@ -236,7 +236,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -262,7 +262,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -288,7 +288,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -314,7 +314,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -341,7 +341,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User Name @ Localhost', 'label' => 'User Name @ Localhost (user name@localhost)', 'uuid' => 'uid3', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User Name @ Localhost', 'label' => 'User Name @ Localhost (user name@localhost)', 'uuid' => 'uid3', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -368,7 +368,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'user space (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user space@remote', 'server' => 'remote'], 'uuid' => 'user space', 'name' => 'user space']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'user space (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'user space@remote', 'server' => 'remote'], 'uuid' => 'user space', 'name' => 'user space']]]],
false,
true,
],
diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
index 84d270de547..98e454f2834 100644
--- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
@@ -31,7 +31,7 @@ use OCP\IContainer;
use Test\TestCase;
class SearchResultTest extends TestCase {
- /** @var IContainer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
protected $container;
/** @var ISearch */
protected $search;
diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php
index 1b68e8eacc1..0aebef72de0 100644
--- a/tests/lib/Collaboration/Collaborators/SearchTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchTest.php
@@ -29,11 +29,11 @@ use OCP\Collaboration\Collaborators\ISearch;
use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\IContainer;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class SearchTest extends TestCase {
- /** @var IContainer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
protected $container;
/** @var ISearch */
protected $search;
@@ -132,7 +132,7 @@ class SearchTest extends TestCase {
public function dataSearchSharees() {
return [
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [],
@@ -141,7 +141,7 @@ class SearchTest extends TestCase {
], false
],
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [],
@@ -150,66 +150,66 @@ class SearchTest extends TestCase {
], false
],
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [
- ['label' => 'testgroup1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'testgroup1']],
+ ['label' => 'testgroup1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'testgroup1']],
], [
- 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false,
+ 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false,
],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
'groups' => [
- ['label' => 'testgroup1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'testgroup1']],
+ ['label' => 'testgroup1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'testgroup1']],
],
'remotes' => [
- ['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
+ ['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
], true,
],
// No groups requested
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_REMOTE], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_REMOTE], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [], [
- 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false
+ 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false
],
[
'exact' => ['users' => [], 'remotes' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
'remotes' => [
- ['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
+ ['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
], false,
],
// Share type restricted to user - Only one user
[
- 'test', [Share::SHARE_TYPE_USER], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [], [],
[
'exact' => ['users' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
], false,
],
// Share type restricted to user - Multipage result
[
- 'test', [Share::SHARE_TYPE_USER], 1, 2, [
- ['label' => 'test 1', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ 'test', [IShare::TYPE_USER], 1, 2, [
+ ['label' => 'test 1', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test 2', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
], [], [],
[
'exact' => ['users' => []],
'users' => [
- ['label' => 'test 1', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'test 1', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test 2', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
], true,
],
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index 0256c1eb157..6c4ffcc52d8 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -32,20 +32,20 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class UserPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $session;
/** @var UserPlugin */
@@ -60,7 +60,7 @@ class UserPluginTest extends TestCase {
/** @var int */
protected $offset = 0;
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
protected function setUp(): void {
@@ -144,13 +144,13 @@ class UserPluginTest extends TestCase {
[
'test', false, true, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', false, false, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -164,13 +164,13 @@ class UserPluginTest extends TestCase {
[
'test', true, true, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', true, false, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -183,7 +183,7 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
true,
false,
@@ -212,8 +212,8 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -243,11 +243,11 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -263,7 +263,7 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
],
[],
true,
@@ -275,15 +275,16 @@ class UserPluginTest extends TestCase {
true,
['abc', 'xyz'],
[
- ['abc', 'test', 2, 0, [$this->getUserMock('test1', 'Test One')]],
+ ['abc', 'test', 2, 0, ['test1' => 'Test One']],
['xyz', 'test', 2, 0, []],
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
true,
false,
+ [['test1', $this->getUserMock('test1', 'Test One')]],
],
[
'test',
@@ -291,13 +292,14 @@ class UserPluginTest extends TestCase {
false,
['abc', 'xyz'],
[
- ['abc', 'test', 2, 0, [$this->getUserMock('test1', 'Test One')]],
+ ['abc', 'test', 2, 0, ['test1' => 'Test One']],
['xyz', 'test', 2, 0, []],
],
[],
[],
true,
false,
+ [['test1', $this->getUserMock('test1', 'Test One')]],
],
[
'test',
@@ -306,21 +308,25 @@ class UserPluginTest extends TestCase {
['abc', 'xyz'],
[
['abc', 'test', 2, 0, [
- $this->getUserMock('test1', 'Test One'),
- $this->getUserMock('test2', 'Test Two'),
+ 'test1' => 'Test One',
+ 'test2' => 'Test Two',
]],
['xyz', 'test', 2, 0, [
- $this->getUserMock('test1', 'Test One'),
- $this->getUserMock('test2', 'Test Two'),
+ 'test1' => 'Test One',
+ 'test2' => 'Test Two',
]],
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
+ [
+ ['test1', $this->getUserMock('test1', 'Test One')],
+ ['test2', $this->getUserMock('test2', 'Test Two')],
+ ],
],
[
'test',
@@ -329,18 +335,22 @@ class UserPluginTest extends TestCase {
['abc', 'xyz'],
[
['abc', 'test', 2, 0, [
- $this->getUserMock('test1', 'Test One'),
- $this->getUserMock('test2', 'Test Two'),
+ 'test1' => 'Test One',
+ 'test2' => 'Test Two',
]],
['xyz', 'test', 2, 0, [
- $this->getUserMock('test1', 'Test One'),
- $this->getUserMock('test2', 'Test Two'),
+ 'test1' => 'Test One',
+ 'test2' => 'Test Two',
]],
],
[],
[],
true,
false,
+ [
+ ['test1', $this->getUserMock('test1', 'Test One')],
+ ['test2', $this->getUserMock('test2', 'Test Two')],
+ ],
],
[
'test',
@@ -349,20 +359,24 @@ class UserPluginTest extends TestCase {
['abc', 'xyz'],
[
['abc', 'test', 2, 0, [
- $this->getUserMock('test', 'Test One'),
+ 'test' => 'Test One',
]],
['xyz', 'test', 2, 0, [
- $this->getUserMock('test2', 'Test Two'),
+ 'test2' => 'Test Two',
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
],
[
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
+ [
+ ['test', $this->getUserMock('test', 'Test One')],
+ ['test2', $this->getUserMock('test2', 'Test Two')],
+ ],
],
[
'test',
@@ -371,18 +385,22 @@ class UserPluginTest extends TestCase {
['abc', 'xyz'],
[
['abc', 'test', 2, 0, [
- $this->getUserMock('test', 'Test One'),
+ 'test' => 'Test One',
]],
['xyz', 'test', 2, 0, [
- $this->getUserMock('test2', 'Test Two'),
+ 'test2' => 'Test Two',
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
],
[],
true,
false,
+ [
+ ['test', $this->getUserMock('test', 'Test One')],
+ ['test2', $this->getUserMock('test2', 'Test Two')],
+ ],
],
];
}
@@ -399,6 +417,7 @@ class UserPluginTest extends TestCase {
* @param array $expected
* @param bool $reachedEnd
* @param bool|IUser $singleUser
+ * @param array $users
*/
public function testSearch(
$searchTerm,
@@ -409,7 +428,8 @@ class UserPluginTest extends TestCase {
array $exactExpected,
array $expected,
$reachedEnd,
- $singleUser
+ $singleUser,
+ array $users = []
) {
$this->mockConfig($shareWithGroupOnly, $shareeEnumeration, false);
$this->instantiatePlugin();
@@ -424,39 +444,29 @@ class UserPluginTest extends TestCase {
->with($searchTerm, $this->limit, $this->offset)
->willReturn($userResponse);
} else {
- $groups = array_combine($groupResponse, array_map(function ($gid) {
- return $this->getGroupMock($gid);
- }, $groupResponse));
- if ($singleUser !== false) {
- $this->groupManager->method('getUserGroups')
- ->with($this->user)
- ->willReturn($groups);
+ $this->groupManager->method('getUserGroupIds')
+ ->with($this->user)
+ ->willReturn($groupResponse);
+ if ($singleUser !== false) {
$this->groupManager->method('getUserGroupIds')
->with($singleUser)
->willReturn($groupResponse);
- } else {
- $this->groupManager->expects($this->once())
- ->method('getUserGroups')
- ->with($this->user)
- ->willReturn($groups);
}
- foreach ($userResponse as $groupDefinition) {
- [$gid, $search, $limit, $offset, $users] = $groupDefinition;
- $groups[$gid]->method('searchDisplayName')
- ->with($search, $limit, $offset)
- ->willReturn($users);
- }
+ $this->groupManager->method('displayNamesInGroup')
+ ->willReturnMap($userResponse);
}
if ($singleUser !== false) {
- $this->userManager->expects($this->once())
- ->method('get')
- ->with($searchTerm)
- ->willReturn($singleUser);
+ $users[] = [$searchTerm, $singleUser];
}
+ if (!empty($users)) {
+ $this->userManager->expects($this->atLeastOnce())
+ ->method('get')
+ ->willReturnMap($users);
+ }
$moreResults = $this->plugin->search($searchTerm, $this->limit, $this->offset, $this->searchResult);
$result = $this->searchResult->asArray();
diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php
index 594d17168d6..fefed296a0c 100644
--- a/tests/lib/Command/Integrity/SignAppTest.php
+++ b/tests/lib/Command/Integrity/SignAppTest.php
@@ -30,13 +30,13 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SignAppTest extends TestCase {
- /** @var Checker|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Checker|\PHPUnit\Framework\MockObject\MockObject */
private $checker;
/** @var SignApp */
private $signApp;
- /** @var FileAccessHelper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var FileAccessHelper|\PHPUnit\Framework\MockObject\MockObject */
private $fileAccessHelper;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
protected function setUp(): void {
@@ -76,7 +76,7 @@ class SignAppTest extends TestCase {
->method('writeln')
->with('This command requires the --path, --privateKey and --certificate.');
- $this->assertNull(self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithMissingPrivateKey() {
@@ -104,7 +104,7 @@ class SignAppTest extends TestCase {
->method('writeln')
->with('This command requires the --path, --privateKey and --certificate.');
- $this->assertNull(self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithMissingCertificate() {
@@ -132,7 +132,7 @@ class SignAppTest extends TestCase {
->method('writeln')
->with('This command requires the --path, --privateKey and --certificate.');
- $this->assertNull(self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithNotExistingPrivateKey() {
@@ -166,7 +166,7 @@ class SignAppTest extends TestCase {
->method('writeln')
->with('Private key "privateKey" does not exists.');
- $this->assertNull(self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithNotExistingCertificate() {
@@ -205,7 +205,7 @@ class SignAppTest extends TestCase {
->method('writeln')
->with('Certificate "certificate" does not exists.');
- $this->assertNull(self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithException() {
diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php
index 36376ef0e7d..3b7fe7f3a8b 100644
--- a/tests/lib/Command/Integrity/SignCoreTest.php
+++ b/tests/lib/Command/Integrity/SignCoreTest.php
@@ -29,9 +29,9 @@ use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SignCoreTest extends TestCase {
- /** @var Checker|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Checker|\PHPUnit\Framework\MockObject\MockObject */
private $checker;
- /** @var FileAccessHelper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var FileAccessHelper|\PHPUnit\Framework\MockObject\MockObject */
private $fileAccessHelper;
/** @var SignCore */
private $signCore;
@@ -66,7 +66,7 @@ class SignCoreTest extends TestCase {
->method('writeln')
->with('--privateKey, --certificate and --path are required.');
- $this->assertNull(self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithMissingCertificate() {
@@ -89,7 +89,7 @@ class SignCoreTest extends TestCase {
->method('writeln')
->with('--privateKey, --certificate and --path are required.');
- $this->assertNull(self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithNotExistingPrivateKey() {
@@ -123,7 +123,7 @@ class SignCoreTest extends TestCase {
->method('writeln')
->with('Private key "privateKey" does not exists.');
- $this->assertNull(self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithNotExistingCertificate() {
@@ -162,7 +162,7 @@ class SignCoreTest extends TestCase {
->method('writeln')
->with('Certificate "certificate" does not exists.');
- $this->assertNull(self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
+ $this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
public function testExecuteWithException() {
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index e2bf6180709..def00fd0dcc 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -67,7 +67,7 @@ class ManagerTest extends TestCase {
return $factory->getManager();
}
-
+
public function testGetCommentNotFound() {
$this->expectException(\OCP\Comments\NotFoundException::class);
@@ -75,7 +75,7 @@ class ManagerTest extends TestCase {
$manager->get('22');
}
-
+
public function testGetCommentNotFoundInvalidInput() {
$this->expectException(\InvalidArgumentException::class);
@@ -125,7 +125,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($comment->getLatestChildDateTime(), $latestChildDT);
}
-
+
public function testGetTreeNotFound() {
$this->expectException(\OCP\Comments\NotFoundException::class);
@@ -133,7 +133,7 @@ class ManagerTest extends TestCase {
$manager->getTree('22');
}
-
+
public function testGetTreeNotFoundInvalidIpnut() {
$this->expectException(\InvalidArgumentException::class);
@@ -335,7 +335,7 @@ class ManagerTest extends TestCase {
$this->addDatabaseEntry(0, 0, null, null, $fileIds[$i]);
}
$this->addDatabaseEntry(0, 0, (new \DateTime())->modify('-2 days'), null, $fileIds[0]);
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
@@ -437,7 +437,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comment->getObjectId(), $objectId);
}
-
+
public function testDelete() {
$this->expectException(\OCP\Comments\NotFoundException::class);
@@ -498,7 +498,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comment->getMessage(), $loadedComment->getMessage());
}
-
+
public function testSaveUpdateException() {
$this->expectException(\OCP\Comments\NotFoundException::class);
@@ -517,7 +517,7 @@ class ManagerTest extends TestCase {
$manager->save($comment);
}
-
+
public function testSaveIncomplete() {
$this->expectException(\UnexpectedValueException::class);
@@ -675,7 +675,7 @@ class ManagerTest extends TestCase {
}
public function testSetMarkRead() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
@@ -692,7 +692,7 @@ class ManagerTest extends TestCase {
}
public function testSetMarkReadUpdate() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
@@ -712,7 +712,7 @@ class ManagerTest extends TestCase {
}
public function testReadMarkDeleteUser() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
@@ -730,7 +730,7 @@ class ManagerTest extends TestCase {
}
public function testReadMarkDeleteObject() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
@@ -800,7 +800,7 @@ class ManagerTest extends TestCase {
$this->assertSame('SOMBRERO', $manager->resolveDisplayName('galaxy', 'sombrero'));
}
-
+
public function testRegisterResolverDuplicate() {
$this->expectException(\OutOfBoundsException::class);
@@ -813,7 +813,7 @@ class ManagerTest extends TestCase {
$manager->registerDisplayNameResolver('planet', $planetClosure);
}
-
+
public function testRegisterResolverInvalidType() {
$this->expectException(\InvalidArgumentException::class);
@@ -825,7 +825,7 @@ class ManagerTest extends TestCase {
$manager->registerDisplayNameResolver(1337, $planetClosure);
}
-
+
public function testResolveDisplayNameUnregisteredType() {
$this->expectException(\OutOfBoundsException::class);
@@ -850,7 +850,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(is_string($manager->resolveDisplayName('planet', 'neptune')));
}
-
+
public function testResolveDisplayNameInvalidType() {
$this->expectException(\InvalidArgumentException::class);
diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php
index aa6c50528cc..d360d115824 100644
--- a/tests/lib/ConfigTest.php
+++ b/tests/lib/ConfigTest.php
@@ -71,9 +71,7 @@ class ConfigTest extends TestCase {
public function testSetValue() {
$this->config->setValue('foo', 'moo');
- $expectedConfig = $this->initialConfig;
- $expectedConfig['foo'] = 'moo';
- $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
+ $this->assertSame('moo', $this->config->getValue('foo'));
$content = file_get_contents($this->configFile);
$expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
@@ -82,9 +80,8 @@ class ConfigTest extends TestCase {
$this->config->setValue('bar', 'red');
$this->config->setValue('apps', ['files', 'gallery']);
- $expectedConfig['bar'] = 'red';
- $expectedConfig['apps'] = ['files', 'gallery'];
- $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
+ $this->assertSame('red', $this->config->getValue('bar'));
+ $this->assertSame(['files', 'gallery'], $this->config->getValue('apps'));
$content = file_get_contents($this->configFile);
@@ -105,7 +102,8 @@ class ConfigTest extends TestCase {
'not_exists' => null,
]);
- $this->assertAttributeEquals($this->initialConfig, 'cache', $this->config);
+ $this->assertSame('bar', $this->config->getValue('foo'));
+ $this->assertSame(null, $this->config->getValue('not_exists'));
$content = file_get_contents($this->configFile);
$this->assertEquals(self::TESTCONTENT, $content);
@@ -113,10 +111,8 @@ class ConfigTest extends TestCase {
'foo' => 'moo',
'alcohol_free' => null,
]);
- $expectedConfig = $this->initialConfig;
- $expectedConfig['foo'] = 'moo';
- unset($expectedConfig['alcohol_free']);
- $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
+ $this->assertSame('moo', $this->config->getValue('foo'));
+ $this->assertSame(null, $this->config->getValue('not_exists'));
$content = file_get_contents($this->configFile);
$expected = "<?php\n\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
@@ -126,9 +122,7 @@ class ConfigTest extends TestCase {
public function testDeleteKey() {
$this->config->deleteKey('foo');
- $expectedConfig = $this->initialConfig;
- unset($expectedConfig['foo']);
- $this->assertAttributeEquals($expectedConfig, 'cache', $this->config);
+ $this->assertSame('this_was_clearly_not_set_before', $this->config->getValue('foo', 'this_was_clearly_not_set_before'));
$content = file_get_contents($this->configFile);
$expected = "<?php\n\$CONFIG = array (\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " .
diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
index ee053ce40e5..f20df96f7a2 100644
--- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
@@ -33,18 +33,17 @@ use OCP\Contacts\ContactsMenu\IProvider;
use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IUser;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class ActionProviderStoreTest extends TestCase {
- /** @var IServerContainer|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IServerContainer|\PHPUnit\Framework\MockObject\MockObject */
private $serverContainer;
- /** @var IAppManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var ActionProviderStore */
@@ -114,7 +113,7 @@ class ActionProviderStoreTest extends TestCase {
$this->assertInstanceOf(EMailProvider::class, $providers[0]);
}
-
+
public function testGetProvidersWithQueryException() {
$this->expectException(\Exception::class);
diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
index 245c89c3228..acfe83ac558 100644
--- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
@@ -31,19 +31,18 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class ContactsStoreTest extends TestCase {
/** @var ContactsStore */
private $contactsStore;
- /** @var IManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
private $contactsManager;
- /** @var IUserManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
private $userManager;
- /** @var IGroupManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
private $groupManager;
- /** @var IConfig|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -57,7 +56,7 @@ class ContactsStoreTest extends TestCase {
}
public function testGetContactsWithoutFilter() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -87,7 +86,7 @@ class ContactsStoreTest extends TestCase {
}
public function testGetContactsHidesOwnEntry() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -114,7 +113,7 @@ class ContactsStoreTest extends TestCase {
}
public function testGetContactsWithoutBinaryImage() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -143,7 +142,7 @@ class ContactsStoreTest extends TestCase {
}
public function testGetContactsWithoutAvatarURI() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -196,7 +195,7 @@ class ContactsStoreTest extends TestCase {
->with($this->equalTo('core'), $this->equalTo('shareapi_exclude_groups_list'), $this->equalTo(''))
->willReturn('["group1", "group5", "group6"]');
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $currentUser */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $currentUser */
$currentUser = $this->createMock(IUser::class);
$currentUser->expects($this->once())
->method('getUID')
@@ -246,7 +245,7 @@ class ContactsStoreTest extends TestCase {
->with($this->equalTo('core'), $this->equalTo('shareapi_only_share_with_group_members'), $this->equalTo('no'))
->willReturn('yes');
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $currentUser */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $currentUser */
$currentUser = $this->createMock(IUser::class);
$currentUser->expects($this->once())
->method('getUID')
@@ -332,7 +331,7 @@ class ContactsStoreTest extends TestCase {
->with($this->equalTo('core'), $this->equalTo('shareapi_only_share_with_group_members'), $this->equalTo('no'))
->willReturn('no');
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $currentUser */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $currentUser */
$currentUser = $this->createMock(IUser::class);
$currentUser->expects($this->once())
->method('getUID')
@@ -405,7 +404,7 @@ class ContactsStoreTest extends TestCase {
->with($this->equalTo('core'), $this->equalTo('shareapi_allow_share_dialog_user_enumeration'), $this->equalTo('yes'))
->willReturn('no');
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->any())
->method('search')
@@ -489,7 +488,7 @@ class ContactsStoreTest extends TestCase {
->with($this->equalTo('core'), $this->equalTo('shareapi_allow_share_dialog_user_enumeration'), $this->equalTo('yes'))
->willReturn('yes');
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -520,7 +519,7 @@ class ContactsStoreTest extends TestCase {
}
public function testFindOneEMail() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
@@ -551,7 +550,7 @@ class ContactsStoreTest extends TestCase {
}
public function testFindOneNotSupportedType() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$entry = $this->contactsStore->findOne($user, 42, 'darren@roner.au');
@@ -560,7 +559,7 @@ class ContactsStoreTest extends TestCase {
}
public function testFindOneNoMatches() {
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
->method('search')
diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
index 561051974b7..4cfbd9c7c90 100644
--- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
@@ -32,21 +32,20 @@ use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\ContactsMenu\IProvider;
use OCP\IConfig;
use OCP\IUser;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class ManagerTest extends TestCase {
- /** @var ContactsStore|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ContactsStore|\PHPUnit\Framework\MockObject\MockObject */
private $contactsStore;
- /** @var IAppManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var IConfig|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ActionProviderStore|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ActionProviderStore|\PHPUnit\Framework\MockObject\MockObject */
private $actionProviderStore;
/** @var Manager */
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
index 157f8574fa4..c0052469aba 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
@@ -29,15 +29,14 @@ use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Contacts\ContactsMenu\IEntry;
use OCP\Contacts\ContactsMenu\ILinkAction;
use OCP\IURLGenerator;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class EMailproviderTest extends TestCase {
- /** @var IActionFactory|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IActionFactory|\PHPUnit\Framework\MockObject\MockObject */
private $actionFactory;
- /** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
/** @var EMailProvider */
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php
index 4699d894e4b..841c510941f 100644
--- a/tests/lib/ContactsManagerTest.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -63,7 +63,7 @@ class ContactsManagerTest extends \Test\TestCase {
* @dataProvider searchProvider
*/
public function testSearch($search1, $search2, $expectedResult) {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook1 = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -94,10 +94,10 @@ class ContactsManagerTest extends \Test\TestCase {
$result = $this->cm->search('');
$this->assertEquals($expectedResult, $result);
}
-
+
public function testDeleteHavePermission() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -117,7 +117,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testDeleteNoPermission() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -135,7 +135,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testDeleteNoAddressbook() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -149,7 +149,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testCreateOrUpdateHavePermission() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -168,7 +168,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testCreateOrUpdateNoPermission() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -186,7 +186,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testCreateOrUpdateNOAdressbook() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -205,7 +205,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
public function testIsEnabledIfSo() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
@@ -217,7 +217,7 @@ class ContactsManagerTest extends \Test\TestCase {
public function testAddressBookEnumeration() {
// create mock for the addressbook
- /** @var \PHPUnit_Framework_MockObject_MockObject|IAddressBook $addressbook */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/DB/DBSchemaTest.php b/tests/lib/DB/DBSchemaTest.php
index 4b249d07c45..9f575a75da6 100644
--- a/tests/lib/DB/DBSchemaTest.php
+++ b/tests/lib/DB/DBSchemaTest.php
@@ -83,8 +83,8 @@ class DBSchemaTest extends TestCase {
$outfile = $this->tempManager->getTemporaryFile();
OC_DB::getDbStructure($outfile);
$content = file_get_contents($outfile);
- $this->assertContains($this->table1, $content);
- $this->assertContains($this->table2, $content);
+ $this->assertStringContainsString($this->table1, $content);
+ $this->assertStringContainsString($this->table2, $content);
}
public function doTestSchemaRemoving() {
diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php
index 2f987adb290..c57b0f22b6f 100644
--- a/tests/lib/DB/MDB2SchemaReaderTest.php
+++ b/tests/lib/DB/MDB2SchemaReaderTest.php
@@ -32,7 +32,7 @@ class MDB2SchemaReaderTest extends TestCase {
* @return IConfig
*/
protected function getConfig() {
- /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject $config */
+ /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index c4e9b1857fb..9b6dec006d6 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -31,9 +31,9 @@ use OCP\Migration\IMigrationStep;
*/
class MigrationsTest extends \Test\TestCase {
- /** @var MigrationService | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var MigrationService | \PHPUnit\Framework\MockObject\MockObject */
private $migrationService;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IDBConnection $db */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | IDBConnection $db */
private $db;
protected function setUp(): void {
diff --git a/tests/lib/DB/OCPostgreSqlPlatformTest.php b/tests/lib/DB/OCPostgreSqlPlatformTest.php
index 0821a988eb5..62a2fc34712 100644
--- a/tests/lib/DB/OCPostgreSqlPlatformTest.php
+++ b/tests/lib/DB/OCPostgreSqlPlatformTest.php
@@ -24,7 +24,7 @@ namespace Test\DB;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
-use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
/**
* Class OCPostgreSqlPlatformTest
@@ -42,8 +42,8 @@ class OCPostgreSqlPlatformTest extends \Test\TestCase {
$sourceSchema = new Schema();
$targetSchema = new Schema();
- $this->createTableAndColumn($sourceSchema, Type::INTEGER);
- $this->createTableAndColumn($targetSchema, Type::BIGINT);
+ $this->createTableAndColumn($sourceSchema, Types::INTEGER);
+ $this->createTableAndColumn($targetSchema, Types::BIGINT);
$comparator = new Comparator();
$diff = $comparator->compare($sourceSchema, $targetSchema);
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index 7b1fee38db3..faf06360e17 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -43,10 +43,10 @@ class QueryBuilderTest extends \Test\TestCase {
/** @var IDBConnection */
protected $connection;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
protected function setUp(): void {
diff --git a/tests/lib/DB/schemDiffData/core.xml b/tests/lib/DB/schemDiffData/core.xml
index 3775eb6cb37..d7edc7dc73e 100644
--- a/tests/lib/DB/schemDiffData/core.xml
+++ b/tests/lib/DB/schemDiffData/core.xml
@@ -526,7 +526,7 @@
<length>4</length>
</field>
- <!-- Constant OCP\Share::SHARE_TYPE_* -->
+ <!-- Constant OCP\Share\IShare::TYPE_* -->
<field>
<name>share_type</name>
<type>integer</type>
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index 3a16327ac18..a8c6f6caebb 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -44,22 +44,22 @@ use Test\TestCase;
*/
class DecryptAllTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject | IUserManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | IUserManager */
protected $userManager;
- /** @var \PHPUnit_Framework_MockObject_MockObject | Manager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | Manager */
protected $encryptionManager;
- /** @var \PHPUnit_Framework_MockObject_MockObject | View */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | View */
protected $view;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \Symfony\Component\Console\Input\InputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
protected $inputInterface;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \Symfony\Component\Console\Output\OutputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
protected $outputInterface;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \OCP\UserInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */
protected $userInterface;
/** @var DecryptAll */
@@ -112,7 +112,7 @@ class DecryptAllTest extends TestCase {
} else {
$this->userManager->expects($this->never())->method('userExists');
}
- /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject | $instance */
+ /** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject | $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
[
@@ -198,7 +198,7 @@ class DecryptAllTest extends TestCase {
*/
public function testDecryptAllUsersFiles($user) {
- /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject | $instance */
+ /** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject | $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
[
@@ -243,7 +243,7 @@ class DecryptAllTest extends TestCase {
}
public function testDecryptUsersFiles() {
- /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject $instance */
+ /** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
[
@@ -313,7 +313,7 @@ class DecryptAllTest extends TestCase {
public function testDecryptFile($isEncrypted) {
$path = 'test.txt';
- /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject $instance */
+ /** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
[
@@ -353,7 +353,7 @@ class DecryptAllTest extends TestCase {
public function testDecryptFileFailure() {
$path = 'test.txt';
- /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject $instance */
+ /** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
[
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php
index 06d9116255f..20bcb6e7ca1 100644
--- a/tests/lib/Encryption/EncryptionWrapperTest.php
+++ b/tests/lib/Encryption/EncryptionWrapperTest.php
@@ -33,13 +33,13 @@ class EncryptionWrapperTest extends TestCase {
/** @var EncryptionWrapper */
private $instance;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \OCP\ILogger */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\ILogger */
private $logger;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Encryption\Manager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */
private $manager;
- /** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Memcache\ArrayCache */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */
private $arrayCache;
protected function setUp(): void {
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index fd33077c78b..bd9bbdecdf1 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -33,13 +33,13 @@ class StorageTest extends TestCase {
/** @var Storage */
protected $storage;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $util;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $view;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $config;
protected function setUp(): void {
diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php
index 47dd7fd01fb..81ac263cb93 100644
--- a/tests/lib/Encryption/ManagerTest.php
+++ b/tests/lib/Encryption/ManagerTest.php
@@ -17,22 +17,22 @@ class ManagerTest extends TestCase {
/** @var Manager */
private $manager;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
- /** @var View|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var View|\PHPUnit\Framework\MockObject\MockObject */
private $view;
- /** @var Util|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Util|\PHPUnit\Framework\MockObject\MockObject */
private $util;
-
- /** @var ArrayCache|\PHPUnit_Framework_MockObject_MockObject */
+
+ /** @var ArrayCache|\PHPUnit\Framework\MockObject\MockObject */
private $arrayCache;
protected function setUp(): void {
@@ -100,7 +100,7 @@ class ManagerTest extends TestCase {
$this->assertEmpty($this->manager->getEncryptionModules());
}
-
+
public function testGetEncryptionModuleUnknown() {
$this->expectException(\OC\Encryption\Exceptions\ModuleDoesNotExistsException::class);
$this->expectExceptionMessage('Module with ID: unknown does not exist.');
diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php
index d7aa24d1f67..08fb08bf797 100644
--- a/tests/lib/Encryption/UpdateTest.php
+++ b/tests/lib/Encryption/UpdateTest.php
@@ -34,22 +34,22 @@ class UpdateTest extends TestCase {
/** @var string */
private $uid;
- /** @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject */
private $view;
- /** @var \OC\Encryption\Util | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Encryption\Util | \PHPUnit\Framework\MockObject\MockObject */
private $util;
- /** @var \OC\Files\Mount\Manager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Files\Mount\Manager | \PHPUnit\Framework\MockObject\MockObject */
private $mountManager;
- /** @var \OC\Encryption\Manager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Encryption\Manager | \PHPUnit\Framework\MockObject\MockObject */
private $encryptionManager;
- /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */
private $encryptionModule;
- /** @var \OC\Encryption\File | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Encryption\File | \PHPUnit\Framework\MockObject\MockObject */
private $fileHelper;
protected function setUp(): void {
@@ -212,7 +212,7 @@ class UpdateTest extends TestCase {
* create mock of the update method
*
* @param array$methods methods which should be set
- * @return \OC\Encryption\Update | \PHPUnit_Framework_MockObject_MockObject
+ * @return \OC\Encryption\Update | \PHPUnit\Framework\MockObject\MockObject
*/
protected function getUpdateMock($methods) {
return $this->getMockBuilder('\OC\Encryption\Update')
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index e1d898f5a86..84d81dd1cbb 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -17,16 +17,16 @@ class UtilTest extends TestCase {
*/
protected $headerSize = 8192;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $view;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
private $config;
/** @var \OC\Encryption\Util */
@@ -94,7 +94,7 @@ class UtilTest extends TestCase {
];
}
-
+
public function testCreateHeaderFailed() {
$this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class);
diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php
index a03be9e45e9..d06d7a9a91e 100644
--- a/tests/lib/Files/AppData/AppDataTest.php
+++ b/tests/lib/Files/AppData/AppDataTest.php
@@ -33,10 +33,10 @@ use OCP\Files\Node;
use OCP\Files\SimpleFS\ISimpleFolder;
class AppDataTest extends \Test\TestCase {
- /** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */
private $rootFolder;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
private $systemConfig;
/** @var IAppData */
diff --git a/tests/lib/Files/AppData/FactoryTest.php b/tests/lib/Files/AppData/FactoryTest.php
index fec464d6e3a..8161bc515ec 100644
--- a/tests/lib/Files/AppData/FactoryTest.php
+++ b/tests/lib/Files/AppData/FactoryTest.php
@@ -28,10 +28,10 @@ use OC\SystemConfig;
use OCP\Files\IRootFolder;
class FactoryTest extends \Test\TestCase {
- /** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */
private $rootFolder;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
private $systemConfig;
/** @var Factory */
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index 97663c16c02..a6d429798e8 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -532,7 +532,7 @@ class CacheTest extends \Test\TestCase {
$folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e";
/**
- * @var \OC\Files\Cache\Cache | \PHPUnit_Framework_MockObject_MockObject $cacheMock
+ * @var \OC\Files\Cache\Cache | \PHPUnit\Framework\MockObject\MockObject $cacheMock
*/
$cacheMock = $this->getMockBuilder(Cache::class)
->setMethods(['normalize'])
diff --git a/tests/lib/Files/Cache/LocalRootScannerTest.php b/tests/lib/Files/Cache/LocalRootScannerTest.php
new file mode 100644
index 00000000000..0a85f000dbc
--- /dev/null
+++ b/tests/lib/Files/Cache/LocalRootScannerTest.php
@@ -0,0 +1,59 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Files\Cache;
+
+use OC\Files\Storage\LocalRootStorage;
+use Test\TestCase;
+
+/**
+ * @group DB
+ */
+class LocalRootScannerTest extends TestCase {
+ /** @var LocalRootStorage */
+ private $storage;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $folder = \OC::$server->getTempManager()->getTemporaryFolder();
+ $this->storage = new LocalRootStorage(['datadir' => $folder]);
+ }
+
+ public function testDontScanUsers() {
+ $this->storage->mkdir('foo');
+ $this->storage->mkdir('foo/bar');
+
+ $this->storage->getScanner()->scan('');
+ $this->assertFalse($this->storage->getCache()->inCache('foo'));
+ }
+
+ public function testDoScanAppData() {
+ $this->storage->mkdir('appdata_foo');
+ $this->storage->mkdir('appdata_foo/bar');
+
+ $this->storage->getScanner()->scan('');
+ $this->assertTrue($this->storage->getCache()->inCache('appdata_foo'));
+ $this->assertTrue($this->storage->getCache()->inCache('appdata_foo/bar'));
+ }
+}
diff --git a/tests/lib/Files/Cache/QuerySearchHelperTest.php b/tests/lib/Files/Cache/QuerySearchHelperTest.php
index 464561681d0..8f97e0158fe 100644
--- a/tests/lib/Files/Cache/QuerySearchHelperTest.php
+++ b/tests/lib/Files/Cache/QuerySearchHelperTest.php
@@ -39,7 +39,7 @@ class QuerySearchHelperTest extends TestCase {
/** @var IQueryBuilder */
private $builder;
- /** @var IMimeTypeLoader|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IMimeTypeLoader|\PHPUnit\Framework\MockObject\MockObject */
private $mimetypeLoader;
/** @var QuerySearchHelper */
diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
index 278872b8728..ea414679888 100644
--- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
@@ -12,13 +12,13 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
/** @var ObjectHomeMountProvider */
protected $provider;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
- /** @var IStorageFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IStorageFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $loader;
protected function setUp(): void {
@@ -216,7 +216,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->user->method('getUID')
->willReturn('uid');
$this->loader->expects($this->never())->method($this->anything());
-
+
$mount = $this->provider->getHomeMountForUser($this->user, $this->loader);
$this->assertInstanceOf('OC\Files\Mount\MountPoint', $mount);
}
diff --git a/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
new file mode 100644
index 00000000000..400808d7cd5
--- /dev/null
+++ b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
@@ -0,0 +1,113 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020, Morris Jobke <hey@morrisjobke.de>
+ *
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Files\Mount;
+
+use OC\Files\Mount\ObjectStorePreviewCacheMountProvider;
+use OC\Files\ObjectStore\S3;
+use OC\Files\Storage\StorageFactory;
+use OCP\Files\Storage\IStorageFactory;
+use OCP\IConfig;
+use OCP\ILogger;
+use PHPUnit\Framework\MockObject\MockObject;
+
+/**
+ * @group DB
+ *
+ * The DB permission is needed for the fake root storage initialization
+ */
+class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
+
+ /** @var ObjectStorePreviewCacheMountProvider */
+ protected $provider;
+
+ /** @var ILogger|MockObject */
+ protected $logger;
+ /** @var IConfig|MockObject */
+ protected $config;
+ /** @var IStorageFactory|MockObject */
+ protected $loader;
+
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->logger = $this->createMock(ILogger::class);
+ $this->config = $this->createMock(IConfig::class);
+ $this->loader = $this->createMock(StorageFactory::class);
+
+ $this->provider = new ObjectStorePreviewCacheMountProvider($this->logger, $this->config);
+ }
+
+ public function testNoMultibucketObjectStorage() {
+ $this->config->expects($this->once())
+ ->method('getSystemValue')
+ ->with('objectstore_multibucket')
+ ->willReturn(null);
+
+ $this->assertEquals([], $this->provider->getRootMounts($this->loader));
+ }
+
+ public function testMultibucketObjectStorage() {
+ $objectstoreConfig = [
+ 'class' => S3::class,
+ 'arguments' => [
+ 'bucket' => 'abc',
+ 'num_buckets' => 64,
+ 'key' => 'KEY',
+ 'secret' => 'SECRET',
+ 'hostname' => 'IP',
+ 'port' => 'PORT',
+ 'use_ssl' => false,
+ 'use_path_style' => true,
+ ],
+ ];
+ $this->config->expects($this->any())
+ ->method('getSystemValue')
+ ->willReturnCallback(function ($config) use ($objectstoreConfig) {
+ if ($config === 'objectstore_multibucket') {
+ return $objectstoreConfig;
+ } elseif ($config === 'objectstore.multibucket.preview-distribution') {
+ return true;
+ }
+ return null;
+ });
+ $this->config->expects($this->once())
+ ->method('getSystemValueString')
+ ->with('instanceid')
+ ->willReturn('INSTANCEID');
+
+ $mounts = $this->provider->getRootMounts($this->loader);
+
+ // 256 mounts for the subfolders and 1 for the fake root
+ $this->assertCount(257, $mounts);
+
+ // do some sanity checks if they have correct mount point paths
+ $this->assertEquals('/appdata_INSTANCEID/preview/0/0/', $mounts[0]->getMountPoint());
+ $this->assertEquals('/appdata_INSTANCEID/preview/2/5/', $mounts[37]->getMountPoint());
+ // also test the path of the fake bucket
+ $this->assertEquals('/appdata_INSTANCEID/preview/old-multibucket/', $mounts[256]->getMountPoint());
+ }
+}
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 3fa988c89d8..6b5aaabbc28 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -33,7 +33,7 @@ class FileTest extends NodeTest {
}
public function testGetContent() {
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
@@ -59,11 +59,11 @@ class FileTest extends NodeTest {
$this->assertEquals('bar', $node->getContent());
}
-
+
public function testGetContentNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
@@ -82,7 +82,7 @@ class FileTest extends NodeTest {
}
public function testPutContent() {
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
@@ -105,11 +105,11 @@ class FileTest extends NodeTest {
$node->putContent('bar');
}
-
+
public function testPutContentNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
@@ -124,7 +124,7 @@ class FileTest extends NodeTest {
}
public function testGetMimeType() {
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
@@ -213,7 +213,7 @@ class FileTest extends NodeTest {
$this->assertEquals(2, $hooksCalled);
}
-
+
public function testFOpenReadNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -238,7 +238,7 @@ class FileTest extends NodeTest {
$node->fopen('r');
}
-
+
public function testFOpenReadWriteNoReadPermissions() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -263,7 +263,7 @@ class FileTest extends NodeTest {
$node->fopen('w');
}
-
+
public function testFOpenReadWriteNoWritePermissions() {
$this->expectException(\OCP\Files\NotPermittedException::class);
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index d2bbf65965a..1ba052b8de4 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -50,7 +50,7 @@ class FolderTest extends NodeTest {
public function testGetDirectoryContent() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -82,7 +82,7 @@ class FolderTest extends NodeTest {
public function testGet() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -103,7 +103,7 @@ class FolderTest extends NodeTest {
public function testNodeExists() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -127,7 +127,7 @@ class FolderTest extends NodeTest {
public function testNodeExistsNotExists() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -149,7 +149,7 @@ class FolderTest extends NodeTest {
public function testNewFolder() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -175,13 +175,13 @@ class FolderTest extends NodeTest {
$this->assertEquals($child, $result);
}
-
+
public function testNewFolderNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -203,7 +203,7 @@ class FolderTest extends NodeTest {
public function testNewFile() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -229,13 +229,13 @@ class FolderTest extends NodeTest {
$this->assertEquals($child, $result);
}
-
+
public function testNewFileNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -257,7 +257,7 @@ class FolderTest extends NodeTest {
public function testGetFreeSpace() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -279,7 +279,7 @@ class FolderTest extends NodeTest {
public function testSearch() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -330,7 +330,7 @@ class FolderTest extends NodeTest {
public function testSearchInRoot() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -340,7 +340,7 @@ class FolderTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
->willReturn($this->user);
- /** @var \PHPUnit_Framework_MockObject_MockObject|Storage $storage */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|Storage $storage */
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -383,7 +383,7 @@ class FolderTest extends NodeTest {
public function testSearchInStorageRoot() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -434,7 +434,7 @@ class FolderTest extends NodeTest {
public function testSearchSubStorages() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -517,7 +517,7 @@ class FolderTest extends NodeTest {
public function testGetById() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -571,7 +571,7 @@ class FolderTest extends NodeTest {
public function testGetByIdMountRoot() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -620,7 +620,7 @@ class FolderTest extends NodeTest {
public function testGetByIdOutsideFolder() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -673,7 +673,7 @@ class FolderTest extends NodeTest {
public function testGetByIdMultipleStorages() {
$manager = $this->createMock(Manager::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -756,7 +756,7 @@ class FolderTest extends NodeTest {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
$root = $this->getMockBuilder(Root::class)
@@ -783,15 +783,15 @@ class FolderTest extends NodeTest {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)
->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
@@ -847,15 +847,15 @@ class FolderTest extends NodeTest {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)
->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
@@ -909,15 +909,15 @@ class FolderTest extends NodeTest {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->createMock(View::class);
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\Node\Root $root */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\Node\Root $root */
$root = $this->getMockBuilder(Root::class)
->setMethods(['getUser', 'getMountsIn', 'getMount'])
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock();
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php
index 004b74e755c..a5e73f18365 100644
--- a/tests/lib/Files/Node/HookConnectorTest.php
+++ b/tests/lib/Files/Node/HookConnectorTest.php
@@ -13,7 +13,6 @@ use OC\Files\Node\HookConnector;
use OC\Files\Node\Root;
use OC\Files\Storage\Temporary;
use OC\Files\View;
-use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\GenericEvent as APIGenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\Node\AbstractNodeEvent;
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 86643617959..6ea5a6d7ffa 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -29,15 +29,15 @@ abstract class NodeTest extends \Test\TestCase {
protected $user;
/** @var \OC\Files\Mount\Manager */
protected $manager;
- /** @var \OC\Files\View|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Files\View|\PHPUnit\Framework\MockObject\MockObject */
protected $view;
- /** @var \OC\Files\Node\Root|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject */
protected $root;
- /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
protected $userMountCache;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
protected function setUp(): void {
@@ -177,7 +177,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(2, $hooksRun);
}
-
+
public function testDeleteNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -307,7 +307,7 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
+ * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
@@ -337,7 +337,7 @@ abstract class NodeTest extends \Test\TestCase {
->method('getUser')
->willReturn($this->user);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
+ * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
@@ -434,7 +434,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(2, $hooksRun);
}
-
+
public function testTouchNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -451,7 +451,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->touch(100);
}
-
+
public function testInvalidPath() {
$this->expectException(\OCP\Files\InvalidPathException::class);
@@ -485,12 +485,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(3, $target->getId());
}
-
+
public function testCopyNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
+ * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->createMock('\OC\Files\Storage\Storage');
@@ -516,7 +516,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->copy('/bar/asd');
}
-
+
public function testCopyNoParent() {
$this->expectException(\OCP\Files\NotFoundException::class);
@@ -533,7 +533,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->copy('/bar/asd/foo');
}
-
+
public function testCopyParentIsFile() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -590,7 +590,7 @@ abstract class NodeTest extends \Test\TestCase {
* @param string $postHookName
*/
public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $postHookName) {
- /** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject $root */
+ /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->setMethods(['get'])
@@ -606,7 +606,7 @@ abstract class NodeTest extends \Test\TestCase {
->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
/**
- * @var \OC\Files\Node\File|\PHPUnit_Framework_MockObject_MockObject $node
+ * @var \OC\Files\Node\File|\PHPUnit\Framework\MockObject\MockObject $node
*/
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($root, $this->view, '/bar');
@@ -656,7 +656,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(4, $hooksRun);
}
-
+
public function testMoveNotPermitted() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -678,12 +678,12 @@ abstract class NodeTest extends \Test\TestCase {
$node->move('/bar/asd');
}
-
+
public function testMoveNoParent() {
$this->expectException(\OCP\Files\NotFoundException::class);
/**
- * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
+ * @var \OC\Files\Storage\Storage | \PHPUnit\Framework\MockObject\MockObject $storage
*/
$storage = $this->createMock('\OC\Files\Storage\Storage');
@@ -700,7 +700,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->move('/bar/asd');
}
-
+
public function testMoveParentIsFile() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -718,7 +718,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->move('/bar/asd');
}
-
+
public function testMoveFailed() {
$this->expectException(\OCP\Files\NotPermittedException::class);
@@ -741,7 +741,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->move('/bar/asd');
}
-
+
public function testCopyFailed() {
$this->expectException(\OCP\Files\NotPermittedException::class);
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 6c006d1cf62..13fdcb65902 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -27,11 +27,11 @@ class RootTest extends \Test\TestCase {
private $user;
/** @var \OC\Files\Mount\Manager */
private $manager;
- /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
private $userMountCache;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
private $userManager;
protected function setUp(): void {
@@ -60,7 +60,7 @@ class RootTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
@@ -85,7 +85,7 @@ class RootTest extends \Test\TestCase {
$this->assertInstanceOf('\OC\Files\Node\File', $node);
}
-
+
public function testGetNotFound() {
$this->expectException(\OCP\Files\NotFoundException::class);
@@ -96,7 +96,7 @@ class RootTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
@@ -119,12 +119,12 @@ class RootTest extends \Test\TestCase {
$root->get('/bar/foo');
}
-
+
public function testGetInvalidPath() {
$this->expectException(\OCP\Files\NotPermittedException::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
@@ -141,12 +141,12 @@ class RootTest extends \Test\TestCase {
$root->get('/../foo');
}
-
+
public function testGetNoStorages() {
$this->expectException(\OCP\Files\NotFoundException::class);
/**
- * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
+ * @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
*/
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
@@ -182,7 +182,7 @@ class RootTest extends \Test\TestCase {
->method('get')
->with('MyUserId')
->willReturn($user);
- /** @var CappedMemoryCache|\PHPUnit_Framework_MockObject_MockObject $cappedMemoryCache */
+ /** @var CappedMemoryCache|\PHPUnit\Framework\MockObject\MockObject $cappedMemoryCache */
$cappedMemoryCache = $this->createMock(CappedMemoryCache::class);
$cappedMemoryCache
->expects($this->once())
@@ -199,7 +199,7 @@ class RootTest extends \Test\TestCase {
$this->assertEquals($folder, $root->getUserFolder('MyUserId'));
}
-
+
public function testGetUserFolderWithNoUserObj() {
$this->expectException(\OC\User\NoUserException::class);
$this->expectExceptionMessage('Backends provided no user object');
diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php
index b9a47c4d6e2..def570edf99 100644
--- a/tests/lib/Files/SimpleFS/SimpleFileTest.php
+++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php
@@ -29,7 +29,7 @@ use OCP\Files\Folder;
use OCP\Files\NotFoundException;
class SimpleFileTest extends \Test\TestCase {
- /** @var File|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var File|\PHPUnit\Framework\MockObject\MockObject */
private $file;
/** @var SimpleFile */
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 73de60e3652..eccec7c28d5 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -37,72 +37,72 @@ class EncryptionTest extends Storage {
private $sourceStorage;
/**
- * @var \OC\Files\Storage\Wrapper\Encryption | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Files\Storage\Wrapper\Encryption | \PHPUnit\Framework\MockObject\MockObject
*/
protected $instance;
/**
- * @var \OC\Encryption\Keys\Storage | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Encryption\Keys\Storage | \PHPUnit\Framework\MockObject\MockObject
*/
private $keyStore;
/**
- * @var \OC\Encryption\Util | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Encryption\Util | \PHPUnit\Framework\MockObject\MockObject
*/
private $util;
/**
- * @var \OC\Encryption\Manager | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Encryption\Manager | \PHPUnit\Framework\MockObject\MockObject
*/
private $encryptionManager;
/**
- * @var \OCP\Encryption\IEncryptionModule | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject
*/
private $encryptionModule;
/**
- * @var \OC\Encryption\Update | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Encryption\Update | \PHPUnit\Framework\MockObject\MockObject
*/
private $update;
/**
- * @var \OC\Files\Cache\Cache | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Files\Cache\Cache | \PHPUnit\Framework\MockObject\MockObject
*/
private $cache;
/**
- * @var \OC\Log | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Log | \PHPUnit\Framework\MockObject\MockObject
*/
private $logger;
/**
- * @var \OC\Encryption\File | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Encryption\File | \PHPUnit\Framework\MockObject\MockObject
*/
private $file;
/**
- * @var \OC\Files\Mount\MountPoint | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Files\Mount\MountPoint | \PHPUnit\Framework\MockObject\MockObject
*/
private $mount;
/**
- * @var \OC\Files\Mount\Manager | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Files\Mount\Manager | \PHPUnit\Framework\MockObject\MockObject
*/
private $mountManager;
/**
- * @var \OC\Group\Manager | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OC\Group\Manager | \PHPUnit\Framework\MockObject\MockObject
*/
private $groupManager;
/**
- * @var \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject
+ * @var \OCP\IConfig | \PHPUnit\Framework\MockObject\MockObject
*/
private $config;
- /** @var \OC\Memcache\ArrayCache | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Memcache\ArrayCache | \PHPUnit\Framework\MockObject\MockObject */
private $arrayCache;
@@ -212,7 +212,7 @@ class EncryptionTest extends Storage {
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return \PHPUnit\Framework\MockObject\MockObject
*/
protected function buildMockModule() {
$this->encryptionModule = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule')
@@ -848,7 +848,7 @@ class EncryptionTest extends Storage {
$mountPoint = '/mountPoint';
- /** @var \OC\Files\Storage\Wrapper\Encryption |\PHPUnit_Framework_MockObject_MockObject $instance */
+ /** @var \OC\Files\Storage\Wrapper\Encryption |\PHPUnit\Framework\MockObject\MockObject $instance */
$instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
->setConstructorArgs(
[
@@ -994,7 +994,7 @@ class EncryptionTest extends Storage {
->getMock();
if ($encryptionModule === true) {
- /** @var IEncryptionModule|\PHPUnit_Framework_MockObject_MockObject $encryptionModule */
+ /** @var IEncryptionModule|\PHPUnit\Framework\MockObject\MockObject $encryptionModule */
$encryptionModule = $this->createMock(IEncryptionModule::class);
}
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index bedce1b6f6d..08264f07fcf 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -12,7 +12,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class EncryptionTest extends \Test\TestCase {
- /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */
private $encryptionModule;
/**
@@ -325,7 +325,7 @@ class EncryptionTest extends \Test\TestCase {
}
/**
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return \PHPUnit\Framework\MockObject\MockObject
*/
protected function buildMockModule() {
$encryptionModule = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule')
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 9dbe2a4e10e..139516ba374 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -13,7 +13,6 @@ use OC\Files\Filesystem;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Common;
use OC\Files\Storage\Temporary;
-use OC\Files\Stream\Quota;
use OC\Files\View;
use OCP\Constants;
use OCP\Files\Config\IMountProvider;
@@ -21,7 +20,7 @@ use OCP\Files\FileInfo;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
-use OCP\Share;
+use OCP\Share\IShare;
use OCP\Util;
use Test\HookHelper;
use Test\TestMoveableMountPoint;
@@ -243,7 +242,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals('/foo.txt', $folderView->getPath($id2));
}
-
+
public function testGetPathNotExisting() {
$this->expectException(\OCP\Files\NotFoundException::class);
@@ -1161,19 +1160,14 @@ class ViewTest extends \Test\TestCase {
private function doTestCopyRenameFail($operation) {
$storage1 = new Temporary([]);
- /** @var \PHPUnit_Framework_MockObject_MockObject|Temporary $storage2 */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|Temporary $storage2 */
$storage2 = $this->getMockBuilder(TemporaryNoCross::class)
->setConstructorArgs([[]])
->setMethods(['fopen'])
->getMock();
- $storage2->expects($this->any())
- ->method('fopen')
- ->willReturnCallback(function ($path, $mode) use ($storage2) {
- /** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Storage\Temporary $storage2 */
- $source = fopen($storage2->getSourcePath($path), $mode);
- return Quota::wrap($source, 9);
- });
+ $storage2->method('writeStream')
+ ->willReturn(0);
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
@@ -1212,7 +1206,7 @@ class ViewTest extends \Test\TestCase {
}
public function testDeleteFailKeepCache() {
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setConstructorArgs([[]])
->setMethods(['unlink'])
@@ -1290,7 +1284,7 @@ class ViewTest extends \Test\TestCase {
$this->assertNull($view->getRelativePath(null));
}
-
+
public function testNullAsRoot() {
$this->expectException(\InvalidArgumentException::class);
@@ -1591,7 +1585,7 @@ class ViewTest extends \Test\TestCase {
->getMock();
}
- /** @var IMountProvider|\PHPUnit_Framework_MockObject_MockObject $mountProvider */
+ /** @var IMountProvider|\PHPUnit\Framework\MockObject\MockObject $mountProvider */
$mountProvider = $this->createMock(IMountProvider::class);
$mountProvider->expects($this->any())
->method('getMountsForUser')
@@ -1678,7 +1672,7 @@ class ViewTest extends \Test\TestCase {
$share = $shareManager->newShare();
$share->setSharedWith('test2')
->setSharedBy($this->user)
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_READ)
->setNode($shareDir);
$shareManager->createShare($share);
@@ -1687,7 +1681,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($view->rename('mount1', 'shareddir/sub'), 'Cannot move mount point into shared folder');
$this->assertFalse($view->rename('mount1', 'shareddir/sub/sub2'), 'Cannot move mount point into shared subfolder');
- $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, Share::SHARE_TYPE_USER, 'test2'));
+ $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, IShare::TYPE_USER, 'test2'));
$userObject->delete();
}
@@ -1828,7 +1822,7 @@ class ViewTest extends \Test\TestCase {
) {
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods([$operation])
->getMock();
@@ -1878,7 +1872,7 @@ class ViewTest extends \Test\TestCase {
$view = new View('/' . $this->user . '/files/');
$path = 'test_file_put_contents.txt';
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods(['fopen'])
->getMock();
@@ -1917,7 +1911,7 @@ class ViewTest extends \Test\TestCase {
$view = new View('/' . $this->user . '/files/');
$path = 'test_file_put_contents.txt';
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods(['fopen'])
->getMock();
@@ -1972,7 +1966,7 @@ class ViewTest extends \Test\TestCase {
}
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods([$operation])
->getMock();
@@ -2054,7 +2048,7 @@ class ViewTest extends \Test\TestCase {
) {
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods([$operation])
->getMock();
@@ -2093,7 +2087,7 @@ class ViewTest extends \Test\TestCase {
public function testLockFileRename($operation, $expectedLockTypeSourceDuring) {
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods([$operation, 'getMetaData', 'filemtime'])
->getMock();
@@ -2159,7 +2153,7 @@ class ViewTest extends \Test\TestCase {
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods(['copy'])
->getMock();
@@ -2278,11 +2272,11 @@ class ViewTest extends \Test\TestCase {
public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring) {
$view = new View('/' . $this->user . '/files/');
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setMethods([$storageOperation])
->getMock();
- /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage2 */
+ /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage2 */
$storage2 = $this->getMockBuilder(Temporary::class)
->setMethods([$storageOperation, 'getMetaData', 'filemtime'])
->getMock();
@@ -2477,7 +2471,7 @@ class ViewTest extends \Test\TestCase {
$mountPoint = '/' . $this->user . '/files/mount/';
// Mock the mount point
- /** @var TestMoveableMountPoint|\PHPUnit_Framework_MockObject_MockObject $mount */
+ /** @var TestMoveableMountPoint|\PHPUnit\Framework\MockObject\MockObject $mount */
$mount = $this->createMock(TestMoveableMountPoint::class);
$mount->expects($this->once())
->method('getMountPoint')
diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php
index 2f2e1c21855..5689fd0fb1f 100644
--- a/tests/lib/GlobalScale/ConfigTest.php
+++ b/tests/lib/GlobalScale/ConfigTest.php
@@ -27,7 +27,7 @@ use Test\TestCase;
class ConfigTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -38,7 +38,7 @@ class ConfigTest extends TestCase {
/**
* @param array $mockMethods
- * @return Config|\PHPUnit_Framework_MockObject_MockObject
+ * @return Config|\PHPUnit\Framework\MockObject\MockObject
*/
public function getInstance($mockMethods = []) {
if (!empty($mockMethods)) {
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index ff1d6e641ea..8b6be03615a 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -61,7 +61,7 @@ class ManagerTest extends TestCase {
/**
* @param null|int $implementedActions
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return \PHPUnit\Framework\MockObject\MockObject
*/
private function getTestBackend($implementedActions = null) {
if ($implementedActions === null) {
@@ -99,7 +99,7 @@ class ManagerTest extends TestCase {
public function testGet() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->any())
@@ -123,7 +123,7 @@ class ManagerTest extends TestCase {
public function testGetNotExists() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -151,7 +151,7 @@ class ManagerTest extends TestCase {
public function testGetMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
$backend1 = $this->getTestBackend();
$backend1->expects($this->any())
@@ -160,7 +160,7 @@ class ManagerTest extends TestCase {
->willReturn(false);
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend2
*/
$backend2 = $this->getTestBackend();
$backend2->expects($this->any())
@@ -178,7 +178,7 @@ class ManagerTest extends TestCase {
}
public function testCreate() {
- /**@var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Backend $backend */
+ /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backendGroupCreated = false;
$backend = $this->getTestBackend();
$backend->expects($this->any())
@@ -202,7 +202,7 @@ class ManagerTest extends TestCase {
}
public function testCreateFailure() {
- /**@var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Backend $backend */
+ /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backendGroupCreated = false;
$backend = $this->getTestBackend(
GroupInterface::ADD_TO_GROUP |
@@ -231,7 +231,7 @@ class ManagerTest extends TestCase {
}
public function testCreateExists() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Backend $backend */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backend = $this->getTestBackend();
$backend->expects($this->any())
->method('groupExists')
@@ -249,7 +249,7 @@ class ManagerTest extends TestCase {
public function testSearch() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -272,7 +272,7 @@ class ManagerTest extends TestCase {
public function testSearchMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
$backend1 = $this->getTestBackend();
$backend1->expects($this->once())
@@ -284,7 +284,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend2
*/
$backend2 = $this->getTestBackend();
$backend2->expects($this->once())
@@ -309,7 +309,7 @@ class ManagerTest extends TestCase {
public function testSearchMultipleBackendsLimitAndOffset() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
$backend1 = $this->getTestBackend();
$backend1->expects($this->once())
@@ -321,7 +321,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend2
*/
$backend2 = $this->getTestBackend();
$backend2->expects($this->once())
@@ -345,7 +345,7 @@ class ManagerTest extends TestCase {
}
public function testSearchResultExistsButGroupDoesNot() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Group\Backend $backend */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backend = $this->createMock(Database::class);
$backend->expects($this->once())
->method('getGroups')
@@ -368,7 +368,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroups() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -391,7 +391,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroupIds() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->method('getUserGroups')
@@ -400,7 +400,7 @@ class ManagerTest extends TestCase {
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
- /** @var \OC\User\User|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$groups = $manager->getUserGroupIds($user);
@@ -413,7 +413,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroupsWithDeletedGroup() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->createMock(Database::class);
$backend->expects($this->once())
@@ -428,7 +428,7 @@ class ManagerTest extends TestCase {
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
- /** @var \OC\User\User|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('getUID')
@@ -440,7 +440,7 @@ class ManagerTest extends TestCase {
public function testInGroup() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -459,7 +459,7 @@ class ManagerTest extends TestCase {
public function testIsAdmin() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -478,7 +478,7 @@ class ManagerTest extends TestCase {
public function testNotAdmin() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->once())
@@ -497,7 +497,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroupsMultipleBackends() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend1
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
$backend1 = $this->getTestBackend();
$backend1->expects($this->once())
@@ -509,7 +509,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend2
*/
$backend2 = $this->getTestBackend();
$backend2->expects($this->once())
@@ -534,7 +534,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackend() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -592,7 +592,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -653,7 +653,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -717,7 +717,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -756,7 +756,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -795,7 +795,7 @@ class ManagerTest extends TestCase {
public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitAndOffsetSpecified() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->exactly(1))
@@ -834,7 +834,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroupsWithAddUser() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$expectedGroups = [];
@@ -871,7 +871,7 @@ class ManagerTest extends TestCase {
public function testGetUserGroupsWithRemoveUser() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$expectedGroups = ['group1'];
@@ -914,7 +914,7 @@ class ManagerTest extends TestCase {
public function testGetUserIdGroups() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend();
$backend->expects($this->any())
@@ -931,7 +931,7 @@ class ManagerTest extends TestCase {
public function testGroupDisplayName() {
/**
- * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend
+ * @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
$backend = $this->getTestBackend(
GroupInterface::ADD_TO_GROUP |
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index 9c3c40c267e..97f74cc2f8f 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -26,15 +26,15 @@ use OCP\ITempManager;
class InstallerTest extends TestCase {
private static $appid = 'testapp';
private $appstore;
- /** @var AppFetcher|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var AppFetcher|\PHPUnit\Framework\MockObject\MockObject */
private $appFetcher;
- /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
private $clientService;
- /** @var ITempManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITempManager|\PHPUnit\Framework\MockObject\MockObject */
private $tempManager;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index f1cd7467169..c79f192a7fb 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -34,21 +34,21 @@ use phpseclib\File\X509;
use Test\TestCase;
class CheckerTest extends TestCase {
- /** @var EnvironmentHelper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var EnvironmentHelper|\PHPUnit\Framework\MockObject\MockObject */
private $environmentHelper;
- /** @var AppLocator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var AppLocator|\PHPUnit\Framework\MockObject\MockObject */
private $appLocator;
/** @var Checker */
private $checker;
- /** @var FileAccessHelper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var FileAccessHelper|\PHPUnit\Framework\MockObject\MockObject */
private $fileAccessHelper;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
private $cacheFactory;
- /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var \OC\Files\Type\Detection|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Files\Type\Detection|\PHPUnit\Framework\MockObject\MockObject */
private $mimeTypeDetector;
protected function setUp(): void {
@@ -82,7 +82,7 @@ class CheckerTest extends TestCase {
);
}
-
+
public function testWriteAppSignatureOfNotExistingApp() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Exception message');
@@ -107,7 +107,7 @@ class CheckerTest extends TestCase {
$this->checker->writeAppSignature('NotExistingApp', $x509, $rsa);
}
-
+
public function testWriteAppSignatureWrongPermissions() {
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[a-zA-Z\\/_-]+ is not writable/');
@@ -480,7 +480,7 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
-
+
public function testWriteCoreSignatureWithException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Exception message');
@@ -504,7 +504,7 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, __DIR__);
}
-
+
public function testWriteCoreSignatureWrongPermissions() {
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/[a-zA-Z\\/_-]+ is not writable/');
@@ -996,7 +996,7 @@ class CheckerTest extends TestCase {
->method('getServerRoot')
->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified');
$signatureDataFile = '{
- "hashes": {
+ "hashes": {
"mimetypelist.js": "dc48de7ad4baa030c5e563350c9a80b274bad783f6f5adbf1595ecef6c6a32e52890a24cb26cddb0aa20193ba52c001150c68d8bfb567f0aed566f4029a190a3"
},
"signature": "dtNDyufRB1jOG3e\/\/Ng6O3ZPnX5wgt3rrD9SpRQ66cpWlixwvGaI6knH85MkWm3q1c+hTYBipJ\/o+nJxHWoxydMXm+F6mC5MvXWfESB\/ag4fvKe0fg25yKstzlrpIyWwcnmOhLE\/sd7D8LZOQXk72PXsIJw4vX2YPyf3peHLevlUkVhB+mfYGDQJfrtPHjJII0Do+TV2MA0qm42q7SO\/zf7Ly24nZP3AoY5bYDMewlrczS2xz9tMN2ikZZcDgHvmC2W4RkaFP9E8ZeAZphKVjyQn6HdSu7EDlJgJ1YtoqTetFzNy\/q7+ODiJDB0KUzKocEDcXF2n2cTKXKCrklB6tEhEnjADhhQNxQouq2soc0ouIujifyH2zBL0sawNxGje5wpuchhCPnWcvQnSJbK1oXnv\/0wSGsp0iSslvx9NXAZ+nQbJnIuodLBl7XuTxxPVa8jDwFdJ7mLrs79ZfN2Op4qF10PiFRoz5VztJm4KWcaWnm\/Xqxke\/6yxY+gU2c6aH\/plwzkcxhdDJjNI\/d+G+b6NSadfcrduO+gTeHK\/go68mx0k1XxCln4Qu31nPmJZcboTvAtHvHXoeqZVAzMpT+jrq+vZ3oVAvFfNpvH4CA3eZebfkV13wV4RaSETyz5QNbnBL24C26aAhkzdShKHJc4NSNV9XdFqN74XEzSZGoc=",
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index 7e1fb8c8886..db4dc4db865 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -24,13 +24,13 @@ use Test\TestCase;
*/
class FactoryTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
protected $request;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
/** @var string */
@@ -57,7 +57,7 @@ class FactoryTest extends TestCase {
/**
* @param array $methods
* @param bool $mockRequestGetHeaderMethod
- * @return Factory|\PHPUnit_Framework_MockObject_MockObject
+ * @return Factory|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getFactory(array $methods = [], $mockRequestGetHeaderMethod = false) {
if ($mockRequestGetHeaderMethod) {
@@ -329,7 +329,7 @@ class FactoryTest extends TestCase {
->with($app)
->willReturn(\OC::$SERVERROOT . '/tests/data/l10n/');
- $this->assertEquals(['cs', 'de', 'en', 'ru'], $factory->findAvailableLanguages($app), '', 0.0, 10, true);
+ $this->assertEqualsCanonicalizing(['cs', 'de', 'en', 'ru'], $factory->findAvailableLanguages($app));
}
public function dataLanguageExists() {
@@ -360,7 +360,7 @@ class FactoryTest extends TestCase {
->with('theme')
->willReturn('abc');
- $this->assertEquals(['en', 'zz'], $factory->findAvailableLanguages($app), '', 0.0, 10, true);
+ $this->assertEqualsCanonicalizing(['en', 'zz'], $factory->findAvailableLanguages($app));
}
/**
diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php
index 9223db716f4..bbbbb145c75 100644
--- a/tests/lib/L10N/LanguageIteratorTest.php
+++ b/tests/lib/L10N/LanguageIteratorTest.php
@@ -29,9 +29,9 @@ use OCP\IUser;
use Test\TestCase;
class LanguageIteratorTest extends TestCase {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var LanguageIterator */
protected $iterator;
diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php
index e4725a3bc1a..91ff79369bf 100644
--- a/tests/lib/Log/LogFactoryTest.php
+++ b/tests/lib/Log/LogFactoryTest.php
@@ -39,13 +39,13 @@ use Test\TestCase;
* @package Test\Log
*/
class LogFactoryTest extends TestCase {
- /** @var IServerContainer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IServerContainer|\PHPUnit\Framework\MockObject\MockObject */
protected $c;
/** @var LogFactory */
protected $factory;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $systemConfig;
protected function setUp(): void {
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index 5ed7b4c9b38..9e0e3c4b66e 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -14,10 +14,10 @@ use OCP\Log\IWriter;
class LoggerTest extends TestCase implements IWriter {
- /** @var \OC\SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var \OCP\Support\CrashReport\IRegistry|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Support\CrashReport\IRegistry|\PHPUnit\Framework\MockObject\MockObject */
private $registry;
/** @var \OCP\ILogger */
diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php
index a900b1fe47d..74f44051988 100644
--- a/tests/lib/Mail/EMailTemplateTest.php
+++ b/tests/lib/Mail/EMailTemplateTest.php
@@ -31,11 +31,11 @@ use OCP\L10N\IFactory;
use Test\TestCase;
class EMailTemplateTest extends TestCase {
- /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
private $defaults;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
- /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
/** @var EMailTemplate */
private $emailTemplate;
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 9e7f6a4134c..3ec2e96dfab 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -26,15 +26,15 @@ use Test\TestCase;
use Swift_SwiftException;
class MailerTest extends TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
private $defaults;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
/** @var Mailer */
private $mailer;
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index 2172a327234..b0641ae332f 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -208,10 +208,10 @@ class MessageTest extends TestCase {
}
public function testPlainTextRenderOption() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|Swift_Message $swiftMessage */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|Swift_Message $swiftMessage */
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()->getMock();
- /** @var \PHPUnit_Framework_MockObject_MockObject|IEMailTemplate $template */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IEMailTemplate $template */
$template = $this->getMockBuilder('\OCP\Mail\IEMailTemplate')
->disableOriginalConstructor()->getMock();
@@ -231,10 +231,10 @@ class MessageTest extends TestCase {
}
public function testBothRenderingOptions() {
- /** @var \PHPUnit_Framework_MockObject_MockObject|Swift_Message $swiftMessage */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|Swift_Message $swiftMessage */
$swiftMessage = $this->getMockBuilder('\Swift_Message')
->disableOriginalConstructor()->getMock();
- /** @var \PHPUnit_Framework_MockObject_MockObject|IEMailTemplate $template */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IEMailTemplate $template */
$template = $this->getMockBuilder('\OCP\Mail\IEMailTemplate')
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php
index 8c467d58269..4e95915e624 100644
--- a/tests/lib/Migration/BackgroundRepairTest.php
+++ b/tests/lib/Migration/BackgroundRepairTest.php
@@ -56,16 +56,16 @@ class TestRepairStep implements IRepairStep {
class BackgroundRepairTest extends TestCase {
- /** @var \OC\BackgroundJob\JobList|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\BackgroundJob\JobList|\PHPUnit\Framework\MockObject\MockObject */
private $jobList;
- /** @var BackgroundRepair|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var BackgroundRepair|\PHPUnit\Framework\MockObject\MockObject */
private $job;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject $dispatcher */
+ /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject $dispatcher */
private $dispatcher;
protected function setUp(): void {
diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php
index 4f1cabc3cba..012130792ac 100644
--- a/tests/lib/NavigationManagerTest.php
+++ b/tests/lib/NavigationManagerTest.php
@@ -25,17 +25,17 @@ use OCP\IUserSession;
use OCP\L10N\IFactory;
class NavigationManagerTest extends TestCase {
- /** @var AppManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var AppManager|\PHPUnit\Framework\MockObject\MockObject */
protected $appManager;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $l10nFac;
- /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
- /** @var IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var \OC\NavigationManager */
@@ -244,7 +244,7 @@ class NavigationManagerTest extends TestCase {
$apps = [
'core_apps' => [
'id' => 'core_apps',
- 'order' => 3,
+ 'order' => 4,
'href' => '/apps/test/',
'icon' => '/apps/settings/img/apps.svg',
'name' => 'Apps',
@@ -256,7 +256,7 @@ class NavigationManagerTest extends TestCase {
$defaults = [
'settings' => [
'id' => 'settings',
- 'order' => 1,
+ 'order' => 2,
'href' => '/apps/test/',
'icon' => '/apps/settings/img/admin.svg',
'name' => 'Settings',
diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php
index 57c7557e86c..cd0d4bd36c8 100644
--- a/tests/lib/Notification/ManagerTest.php
+++ b/tests/lib/Notification/ManagerTest.php
@@ -93,7 +93,7 @@ class ManagerTest extends TestCase {
}
public function testNotify() {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
@@ -116,11 +116,11 @@ class ManagerTest extends TestCase {
$manager->notify($notification);
}
-
+
public function testNotifyInvalid() {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
@@ -143,7 +143,7 @@ class ManagerTest extends TestCase {
}
public function testMarkProcessed() {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
@@ -164,7 +164,7 @@ class ManagerTest extends TestCase {
}
public function testGetCount() {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index f8d80a0ab56..1479e8841a2 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -32,7 +32,7 @@ use Test\TestCase;
class NotificationTest extends TestCase {
/** @var INotification */
protected $notification;
- /** @var IValidator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IValidator|\PHPUnit\Framework\MockObject\MockObject */
protected $validator;
protected function setUp(): void {
@@ -403,7 +403,7 @@ class NotificationTest extends TestCase {
}
public function testAddAction() {
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -417,11 +417,11 @@ class NotificationTest extends TestCase {
$this->assertEquals([], $this->notification->getParsedActions());
}
-
+
public function testAddActionInvalid() {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -433,7 +433,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondPrimary() {
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValid')
@@ -449,7 +449,7 @@ class NotificationTest extends TestCase {
}
public function testAddParsedAction() {
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -463,11 +463,11 @@ class NotificationTest extends TestCase {
$this->assertEquals([], $this->notification->getActions());
}
-
+
public function testAddParsedActionInvalid() {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -479,7 +479,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondParsedPrimary() {
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValidParsed')
@@ -495,7 +495,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionParsedPrimaryEnd() {
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action1 = $this->createMock(IAction::class);
$action1->expects($this->exactly(2))
->method('isValidParsed')
@@ -503,7 +503,7 @@ class NotificationTest extends TestCase {
$action1->expects($this->exactly(2))
->method('isPrimary')
->willReturn(false);
- /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action2 = $this->createMock(IAction::class);
$action2->expects($this->once())
->method('isValidParsed')
@@ -536,7 +536,7 @@ class NotificationTest extends TestCase {
* @param bool $expected
*/
public function testIsValid($isValidCommon, $subject, $expected) {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
'isValidCommon',
@@ -569,7 +569,7 @@ class NotificationTest extends TestCase {
* @param bool $expected
*/
public function testIsParsedValid($isValidCommon, $subject, $expected) {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
'isValidCommon',
@@ -616,7 +616,7 @@ class NotificationTest extends TestCase {
* @param bool $expected
*/
public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected) {
- /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
+ /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
'getApp',
diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php
index d5baa1be2e2..195dac697e5 100644
--- a/tests/lib/OCS/DiscoveryServiceTest.php
+++ b/tests/lib/OCS/DiscoveryServiceTest.php
@@ -29,10 +29,10 @@ use Test\TestCase;
class DiscoveryServiceTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject | ICacheFactory */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | ICacheFactory */
private $cacheFactory;
- /** @var \PHPUnit_Framework_MockObject_MockObject | IClientService */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */
private $clientService;
/** @var IDiscoveryService */
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index 3a46447632d..d2bfcad9955 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -31,7 +31,6 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
-use OCP\IImage;
use OCP\IPreview;
use OCP\Preview\IProviderV2;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -39,19 +38,19 @@ use Symfony\Component\EventDispatcher\GenericEvent;
class GeneratorTest extends \Test\TestCase {
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var IPreview|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IPreview|\PHPUnit\Framework\MockObject\MockObject */
private $previewManager;
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
private $appData;
- /** @var GeneratorHelper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var GeneratorHelper|\PHPUnit\Framework\MockObject\MockObject */
private $helper;
- /** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
private $eventDispatcher;
/** @var Generator */
@@ -183,7 +182,7 @@ class GeneratorTest extends \Test\TestCase {
$this->fail('Unexpected provider requested');
});
- $image = $this->createMock(IImage::class);
+ $image = $this->createMock(\OC_Image::class);
$image->method('width')->willReturn(2048);
$image->method('height')->willReturn(2048);
$image->method('valid')->willReturn(true);
@@ -318,7 +317,7 @@ class GeneratorTest extends \Test\TestCase {
}
private function getMockImage($width, $height, $data = null) {
- $image = $this->createMock(IImage::class);
+ $image = $this->createMock(\OC_Image::class);
$image->method('height')->willReturn($width);
$image->method('width')->willReturn($height);
$image->method('valid')->willReturn(true);
diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php
index b724891cda7..468b715e5e4 100644
--- a/tests/lib/Repair/CleanTagsTest.php
+++ b/tests/lib/Repair/CleanTagsTest.php
@@ -27,7 +27,7 @@ class CleanTagsTest extends \Test\TestCase {
/** @var \OCP\IDBConnection */
protected $connection;
- /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
/** @var int */
diff --git a/tests/lib/Repair/NC11/FixMountStoragesTest.php b/tests/lib/Repair/NC11/FixMountStoragesTest.php
index 1d5af18a8a3..9bc61865235 100644
--- a/tests/lib/Repair/NC11/FixMountStoragesTest.php
+++ b/tests/lib/Repair/NC11/FixMountStoragesTest.php
@@ -68,7 +68,7 @@ class FixMountStoragesTest extends TestCase {
$mount2 = $this->createMount($file2, 1337);
$this->assertStorage($mount2, 1337);
- /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
+ /** @var IOutput|\PHPUnit\Framework\MockObject\MockObject $output */
$output = $this->createMock(IOutput::class);
$output->expects($this->at(0))
->method('info')
diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php
index 331a86d01d0..adfba4a1ce7 100644
--- a/tests/lib/Repair/OldGroupMembershipSharesTest.php
+++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php
@@ -9,8 +9,8 @@
namespace Test\Repair;
use OC\Repair\OldGroupMembershipShares;
-use OC\Share\Constants;
use OCP\Migration\IOutput;
+use OCP\Share\IShare;
/**
* Class OldGroupMembershipSharesTest
@@ -27,13 +27,13 @@ class OldGroupMembershipSharesTest extends \Test\TestCase {
/** @var \OCP\IDBConnection */
protected $connection;
- /** @var \OCP\IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
protected function setUp(): void {
parent::setUp();
- /** \OCP\IGroupManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** \OCP\IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
$this->groupManager = $this->getMockBuilder('OCP\IGroupManager')
->disableOriginalConstructor()
->getMock();
@@ -66,9 +66,9 @@ class OldGroupMembershipSharesTest extends \Test\TestCase {
['not-a-member', 'group', false],
]);
- $parent = $this->createShare(Constants::SHARE_TYPE_GROUP, 'group', null);
- $group2 = $this->createShare(Constants::SHARE_TYPE_GROUP, 'group2', $parent);
- $user1 = $this->createShare(Constants::SHARE_TYPE_USER, 'user1', $parent);
+ $parent = $this->createShare(IShare::TYPE_GROUP, 'group', null);
+ $group2 = $this->createShare(IShare::TYPE_GROUP, 'group2', $parent);
+ $user1 = $this->createShare(IShare::TYPE_USER, 'user1', $parent);
// \OC\Share\Constant::$shareTypeGroupUserUnique === 2
$member = $this->createShare(2, 'member', $parent);
@@ -83,7 +83,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase {
$this->assertEquals([['id' => $parent], ['id' => $group2], ['id' => $user1], ['id' => $member], ['id' => $notAMember]], $rows);
$result->closeCursor();
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php
index 62471fbbe3a..9cba3e8e30a 100644
--- a/tests/lib/Repair/RepairCollationTest.php
+++ b/tests/lib/Repair/RepairCollationTest.php
@@ -84,7 +84,7 @@ class RepairCollationTest extends TestCase {
$tables = $this->repair->getAllNonUTF8BinTables($this->connection);
$this->assertGreaterThanOrEqual(1, count($tables));
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index 23e6b2dad5f..64ae6322657 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -9,10 +9,10 @@
namespace Test\Repair;
use OC\Repair\RepairInvalidShares;
-use OC\Share\Constants;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
+use OCP\Share\IShare;
use Test\TestCase;
/**
@@ -65,7 +65,7 @@ class RepairInvalidSharesTest extends TestCase {
public function testSharesNonExistingParent() {
$qb = $this->connection->getQueryBuilder();
$shareValues = [
- 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('recipientuser1'),
'uid_owner' => $qb->expr()->literal('user1'),
'item_type' => $qb->expr()->literal('folder'),
@@ -110,7 +110,7 @@ class RepairInvalidSharesTest extends TestCase {
$this->assertEquals([['id' => $parent], ['id' => $validChild], ['id' => $invalidChild]], $rows);
$result->closeCursor();
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
@@ -159,7 +159,7 @@ class RepairInvalidSharesTest extends TestCase {
$qb = $this->connection->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'uid_owner' => $qb->expr()->literal('user1'),
'item_type' => $qb->expr()->literal($itemType),
'item_source' => $qb->expr()->literal(123),
@@ -173,7 +173,7 @@ class RepairInvalidSharesTest extends TestCase {
$shareId = $this->getLastShareId();
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index e6c6fdebf42..6f0791964b3 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -39,7 +39,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
$this->savedMimetypeLoader = \OC::$server->getMimeTypeLoader();
$this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
- /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject $config */
+ /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
@@ -99,7 +99,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
private function renameMimeTypes($currentMimeTypes, $fixedMimeTypes) {
$this->addEntries($currentMimeTypes);
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Repair/RepairSqliteAutoincrementTest.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php
index c740384fc0f..9db0d5630aa 100644
--- a/tests/lib/Repair/RepairSqliteAutoincrementTest.php
+++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php
@@ -78,7 +78,7 @@ class RepairSqliteAutoincrementTest extends \Test\TestCase {
public function testConvertIdColumn() {
$this->assertFalse($this->checkAutoincrement());
- /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */
+ /** @var IOutput | \PHPUnit\Framework\MockObject\MockObject $outputMock */
$outputMock = $this->getMockBuilder('\OCP\Migration\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Security/Bruteforce/CapabilitiesTest.php b/tests/lib/Security/Bruteforce/CapabilitiesTest.php
index 60873236e44..16c2b2caf15 100644
--- a/tests/lib/Security/Bruteforce/CapabilitiesTest.php
+++ b/tests/lib/Security/Bruteforce/CapabilitiesTest.php
@@ -30,10 +30,10 @@ class CapabilitiesTest extends TestCase {
/** @var Capabilities */
private $capabilities;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
private $request;
- /** @var Throttler|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */
private $throttler;
protected function setUp(): void {
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index 1c58849c9f8..b4a7016bc20 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -41,7 +41,7 @@ class ThrottlerTest extends TestCase {
private $dbConnection;
/** @var ILogger */
private $logger;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -153,7 +153,7 @@ class ThrottlerTest extends TestCase {
'dead:beef:cafe::1111',
[
'whitelist_0' => 'dead:beef:cafe::1100/123',
-
+
],
true,
],
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index d64c41c79e7..447ee8719c9 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -92,7 +92,7 @@ class CertificateManagerTest extends \Test\TestCase {
$this->assertEqualsArrays($certificateStore, $this->certificateManager->listCertificates());
}
-
+
public function testAddInvalidCertificate() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');
@@ -156,7 +156,7 @@ class CertificateManagerTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$config = $this->createMock(IConfig::class);
- /** @var CertificateManager | \PHPUnit_Framework_MockObject_MockObject $certificateManager */
+ /** @var CertificateManager | \PHPUnit\Framework\MockObject\MockObject $certificateManager */
$certificateManager = $this->getMockBuilder('OC\Security\CertificateManager')
->setConstructorArgs([$uid, $view, $config, $this->createMock(ILogger::class), $this->random])
->setMethods(['getFilemtimeOfCaBundle', 'getCertificateBundle'])
diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php
index 5fd1d709c2f..760c4911873 100644
--- a/tests/lib/Security/IdentityProof/ManagerTest.php
+++ b/tests/lib/Security/IdentityProof/ManagerTest.php
@@ -52,7 +52,7 @@ class ManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject $factory */
$this->factory = $this->createMock(Factory::class);
$this->appData = $this->createMock(AppData::class);
$this->config = $this->createMock(IConfig::class);
@@ -70,7 +70,7 @@ class ManagerTest extends TestCase {
* create manager object
*
* @param array $setMethods
- * @return Manager|\PHPUnit_Framework_MockObject_MockObject
+ * @return Manager|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getManager($setMethods = []) {
if (empty($setMethods)) {
@@ -204,7 +204,7 @@ class ManagerTest extends TestCase {
public function testGetSystemKey() {
$manager = $this->getManager(['retrieveKey']);
- /** @var Key|\PHPUnit_Framework_MockObject_MockObject $key */
+ /** @var Key|\PHPUnit\Framework\MockObject\MockObject $key */
$key = $this->createMock(Key::class);
$this->config->expects($this->once())->method('getSystemValue')
@@ -217,13 +217,13 @@ class ManagerTest extends TestCase {
}
-
+
public function testGetSystemKeyFailure() {
$this->expectException(\RuntimeException::class);
$manager = $this->getManager(['retrieveKey']);
- /** @var Key|\PHPUnit_Framework_MockObject_MockObject $key */
+ /** @var Key|\PHPUnit\Framework\MockObject\MockObject $key */
$key = $this->createMock(Key::class);
$this->config->expects($this->once())->method('getSystemValue')
diff --git a/tests/lib/Security/IdentityProof/SignerTest.php b/tests/lib/Security/IdentityProof/SignerTest.php
index 913ab7c15f5..3ce211d51e7 100644
--- a/tests/lib/Security/IdentityProof/SignerTest.php
+++ b/tests/lib/Security/IdentityProof/SignerTest.php
@@ -77,13 +77,13 @@ gQIDAQAB
/** @var Key */
private $key;
- /** @var Manager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */
private $keyManager;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
private $userManager;
/** @var Signer */
diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
index e4df424c2ca..902c586dc13 100644
--- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
+++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
@@ -28,11 +28,11 @@ use OCP\ICacheFactory;
use Test\TestCase;
class MemoryCacheTest extends TestCase {
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
private $cacheFactory;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
- /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICache|\PHPUnit\Framework\MockObject\MockObject */
private $cache;
/** @var MemoryCache */
private $memoryCache;
diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php
index ea74f476f3c..76121a49bc1 100644
--- a/tests/lib/Security/RateLimiting/LimiterTest.php
+++ b/tests/lib/Security/RateLimiting/LimiterTest.php
@@ -28,9 +28,9 @@ use OCP\IUser;
use Test\TestCase;
class LimiterTest extends TestCase {
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
- /** @var IBackend|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IBackend|\PHPUnit\Framework\MockObject\MockObject */
private $backend;
/** @var Limiter */
private $limiter;
@@ -47,7 +47,7 @@ class LimiterTest extends TestCase {
);
}
-
+
public function testRegisterAnonRequestExceeded() {
$this->expectException(\OC\Security\RateLimiting\Exception\RateLimitExceededException::class);
$this->expectExceptionMessage('Rate limit exceeded');
@@ -91,12 +91,12 @@ class LimiterTest extends TestCase {
$this->limiter->registerAnonRequest('MyIdentifier', 100, 100, '127.0.0.1');
}
-
+
public function testRegisterUserRequestExceeded() {
$this->expectException(\OC\Security\RateLimiting\Exception\RateLimitExceededException::class);
$this->expectExceptionMessage('Rate limit exceeded');
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
@@ -116,7 +116,7 @@ class LimiterTest extends TestCase {
}
public function testRegisterUserRequestSuccess() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php
index 6de44032530..10bc62e099c 100644
--- a/tests/lib/Session/CryptoSessionDataTest.php
+++ b/tests/lib/Session/CryptoSessionDataTest.php
@@ -25,7 +25,7 @@ use OC\Session\CryptoSessionData;
use OCP\Security\ICrypto;
class CryptoSessionDataTest extends Session {
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OCP\Security\ICrypto */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\Security\ICrypto */
protected $crypto;
/** @var \OCP\ISession */
diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php
index fac515c8f52..b8635b99120 100644
--- a/tests/lib/Session/CryptoWrappingTest.php
+++ b/tests/lib/Session/CryptoWrappingTest.php
@@ -26,10 +26,10 @@ use OCP\ISession;
use Test\TestCase;
class CryptoWrappingTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OCP\Security\ICrypto */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\Security\ICrypto */
protected $crypto;
- /** @var \PHPUnit_Framework_MockObject_MockObject|\OCP\ISession */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OCP\ISession */
protected $wrappedSession;
/** @var \OC\Session\CryptoSessionData */
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index a0d341266e8..3d967b2ed21 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -36,17 +36,17 @@ use Test\TestCase;
class ManagerTest extends TestCase {
- /** @var Manager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */
private $manager;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var IDBConnection|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
- /** @var IFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */
private $l10nFactory;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $url;
- /** @var IServerContainer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IServerContainer|\PHPUnit\Framework\MockObject\MockObject */
private $container;
protected function setUp(): void {
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index 0890b70dfcd..696e1d69fbe 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -19,21 +19,21 @@ use OCP\Security\ISecureRandom;
class SetupTest extends \Test\TestCase {
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
private $iniWrapper;
- /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
- /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
private $defaults;
- /** @var \OC\Setup|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Setup|\PHPUnit\Framework\MockObject\MockObject */
protected $setupClass;
- /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var \OCP\Security\ISecureRandom|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Security\ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */
protected $random;
- /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
protected $installer;
protected function setUp(): void {
@@ -120,7 +120,7 @@ class SetupTest extends \Test\TestCase {
$this->assertSame($expectedResult, $result);
}
-
+
public function testGetSupportedDatabaseException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Supported databases are not properly configured.');
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index fce963ec43a..85cb188cbb3 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -21,11 +21,11 @@
namespace Test\Share;
-use OC\Share\Share;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\Share\IShare;
/**
* Class Test_Share
@@ -140,15 +140,15 @@ class ShareTest extends \Test\TestCase {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target1', IShare::TYPE_USER, $this->user2->getUID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target2', IShare::TYPE_USER, $this->user4->getUID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()];
+ $args = ['test', 99, 'target3', IShare::TYPE_USER, $this->user3->getUID(), $this->user2->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_USER, $this->user3->getUID(), $this->user4->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_USER, $this->user6->getUID(), $this->user4->getUID()];
$query->execute($args);
@@ -180,13 +180,13 @@ class ShareTest extends \Test\TestCase {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target1', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target2', IShare::TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()];
+ $args = ['test', 99, 'target3', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()];
$query->execute($args);
// user2 is in group1 and group2
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index 6f8a96fab19..24474b11dcf 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -28,6 +28,7 @@ use OCP\Defaults;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroup;
use OCP\IGroupManager;
@@ -35,8 +36,10 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\L10N\IFactory;
use OCP\Mail\IMailer;
use OCP\Share\IShare;
+use PHPUnit\Framework\MockObject\MockObject;
/**
* Class DefaultShareProviderTest
@@ -49,39 +52,47 @@ class DefaultShareProviderTest extends \Test\TestCase {
/** @var IDBConnection */
protected $dbConn;
- /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
- /** @var IGroupManager | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IGroupManager | \PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IRootFolder | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRootFolder | \PHPUnit\Framework\MockObject\MockObject */
protected $rootFolder;
/** @var DefaultShareProvider */
protected $provider;
- /** @var \PHPUnit_Framework_MockObject_MockObject|IMailer */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IMailer */
protected $mailer;
- /** @var \PHPUnit_Framework_MockObject_MockObject|IL10N */
+ /** @var IFactory|MockObject */
+ protected $l10nFactory;
+
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IL10N */
protected $l10n;
- /** @var \PHPUnit_Framework_MockObject_MockObject|Defaults */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|Defaults */
protected $defaults;
- /** @var \PHPUnit_Framework_MockObject_MockObject|IURLGenerator */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IURLGenerator */
protected $urlGenerator;
+ /** @var IConfig|MockObject */
+ protected $config;
+
protected function setUp(): void {
$this->dbConn = \OC::$server->getDatabaseConnection();
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->rootFolder = $this->createMock(IRootFolder::class);
$this->mailer = $this->createMock(IMailer::class);
+ $this->l10nFactory = $this->createMock(IFactory::class);
$this->l10n = $this->createMock(IL10N::class);
$this->defaults = $this->getMockBuilder(Defaults::class)->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->config = $this->createMock(IConfig::class);
$this->userManager->expects($this->any())->method('userExists')->willReturn(true);
@@ -95,8 +106,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
);
}
@@ -177,7 +189,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -208,7 +220,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getShareById($id);
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('sharedBy', $share->getSharedBy());
$this->assertEquals('shareOwner', $share->getShareOwner());
@@ -224,7 +236,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -244,7 +256,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
// We do not fetch the node so the rootfolder is never called.
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('sharedBy', $share->getSharedBy());
$this->assertEquals('shareOwner', $share->getShareOwner());
@@ -259,7 +271,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -287,7 +299,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
// We fetch the node so the root folder is eventually called
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('sharedBy', $share->getSharedBy());
$this->assertEquals('shareOwner', $share->getShareOwner());
@@ -303,7 +315,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -330,7 +342,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getShareById($id);
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('sharedBy', $share->getSharedBy());
$this->assertEquals('shareOwner', $share->getShareOwner());
@@ -342,7 +354,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testGetShareByIdUserGroupShare() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user0', 'user0', 'file', 42, 'myTarget', 31, null, null);
+ $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user0', 'user0', 'file', 42, 'myTarget', 31, null, null);
$this->addShareToDB(2, 'user1', 'user0', 'user0', 'file', 42, 'userTarget', 0, null, null, $id);
$user0 = $this->createMock(IUser::class);
@@ -368,7 +380,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getShareById($id, 'user1');
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
$this->assertSame('group0', $share->getSharedWith());
$this->assertSame('user0', $share->getSharedBy());
$this->assertSame('user0', $share->getShareOwner());
@@ -384,7 +396,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'password' => $qb->expr()->literal('password'),
'password_by_talk' => $qb->expr()->literal(true),
'uid_owner' => $qb->expr()->literal('shareOwner'),
@@ -413,7 +425,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getShareById($id);
$this->assertEquals($id, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_LINK, $share->getShareType());
$this->assertNull($share->getSharedWith());
$this->assertEquals('password', $share->getPassword());
$this->assertEquals(true, $share->getSendPasswordByTalk());
@@ -430,7 +442,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('sharedBy'),
'item_type' => $qb->expr()->literal('file'),
@@ -454,8 +466,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
])
->setMethods(['getShareById'])
->getMock();
@@ -477,7 +490,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -510,7 +523,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('sharedBy'),
'item_type' => $qb->expr()->literal('file'),
@@ -537,7 +550,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->createMock(IShare::class);
$share->method('getId')->willReturn($id);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
+ $share->method('getShareType')->willReturn(IShare::TYPE_GROUP);
/** @var DefaultShareProvider $provider */
$provider = $this->getMockBuilder(DefaultShareProvider::class)
@@ -548,8 +561,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
])
->setMethods(['getShareById'])
->getMock();
@@ -571,7 +585,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -588,7 +602,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('user1'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('user2'),
@@ -603,7 +617,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('group1'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('user3'),
@@ -633,7 +647,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertCount(2, $children);
//Child1
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $children[0]->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $children[0]->getShareType());
$this->assertEquals('user1', $children[0]->getSharedWith());
$this->assertEquals('user2', $children[0]->getSharedBy());
$this->assertEquals('shareOwner', $children[0]->getShareOwner());
@@ -644,7 +658,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget1', $children[0]->getTarget());
//Child2
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $children[1]->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $children[1]->getShareType());
$this->assertEquals('group1', $children[1]->getSharedWith());
$this->assertEquals('user3', $children[1]->getSharedBy());
$this->assertEquals('shareOwner', $children[1]->getShareOwner());
@@ -681,7 +695,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->with(100)
->willReturn([$path]);
- $share->setShareType(\OCP\Share::SHARE_TYPE_USER);
+ $share->setShareType(IShare::TYPE_USER);
$share->setSharedWith('sharedWith');
$share->setSharedBy('sharedBy');
$share->setShareOwner('shareOwner');
@@ -695,7 +709,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertNotNull($share2->getId());
$this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId());
- $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share2->getShareType());
+ $this->assertSame(IShare::TYPE_USER, $share2->getShareType());
$this->assertSame('sharedWith', $share2->getSharedWith());
$this->assertSame('sharedBy', $share2->getSharedBy());
$this->assertSame('shareOwner', $share2->getShareOwner());
@@ -737,7 +751,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->with(100)
->willReturn([$path]);
- $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
+ $share->setShareType(IShare::TYPE_GROUP);
$share->setSharedWith('sharedWith');
$share->setSharedBy('sharedBy');
$share->setShareOwner('shareOwner');
@@ -751,7 +765,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertNotNull($share2->getId());
$this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId());
- $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $share2->getShareType());
+ $this->assertSame(IShare::TYPE_GROUP, $share2->getShareType());
$this->assertSame('sharedWith', $share2->getSharedWith());
$this->assertSame('sharedBy', $share2->getSharedBy());
$this->assertSame('shareOwner', $share2->getShareOwner());
@@ -793,7 +807,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->with(100)
->willReturn([$path]);
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK);
+ $share->setShareType(IShare::TYPE_LINK);
$share->setSharedBy('sharedBy');
$share->setShareOwner('shareOwner');
$share->setNode($path);
@@ -809,7 +823,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertNotNull($share2->getId());
$this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId());
- $this->assertSame(\OCP\Share::SHARE_TYPE_LINK, $share2->getShareType());
+ $this->assertSame(IShare::TYPE_LINK, $share2->getShareType());
$this->assertSame('sharedBy', $share2->getSharedBy());
$this->assertSame('shareOwner', $share2->getShareOwner());
$this->assertSame(1, $share2->getPermissions());
@@ -827,7 +841,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'password' => $qb->expr()->literal('password'),
'password_by_talk' => $qb->expr()->literal(true),
'uid_owner' => $qb->expr()->literal('shareOwner'),
@@ -907,7 +921,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -922,7 +936,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith2'),
'uid_owner' => $qb->expr()->literal('shareOwner2'),
'uid_initiator' => $qb->expr()->literal('sharedBy2'),
@@ -937,7 +951,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
- $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_USER, null, 1 , 0);
+ $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_USER, null, 1 , 0);
$this->assertCount(1, $share);
$share = $share[0];
@@ -945,7 +959,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('shareOwner', $share->getShareOwner());
$this->assertEquals('sharedBy', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
}
/**
@@ -958,7 +972,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner2'),
'uid_initiator' => $qb->expr()->literal('sharedBy2'),
@@ -972,7 +986,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1009,7 +1023,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
- $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_GROUP, null, 20 , 1);
+ $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_GROUP, null, 20 , 1);
$this->assertCount(1, $share);
$share = $share[0];
@@ -1017,7 +1031,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('shareOwner', $share->getShareOwner());
$this->assertEquals('sharedBy', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
}
/**
@@ -1029,7 +1043,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1097,7 +1111,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
- $share = $this->provider->getSharedWith('user', \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0);
+ $share = $this->provider->getSharedWith('user', IShare::TYPE_GROUP, null, -1, 0);
$this->assertCount(1, $share);
$share = $share[0];
@@ -1105,7 +1119,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('sharedWith', $share->getSharedWith());
$this->assertSame('shareOwner', $share->getShareOwner());
$this->assertSame('sharedBy', $share->getSharedBy());
- $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertSame(IShare::TYPE_GROUP, $share->getShareType());
$this->assertSame(0, $share->getPermissions());
$this->assertSame('userTarget', $share->getTarget());
}
@@ -1117,9 +1131,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
- $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1',
+ $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1',
'file', $fileId, 'myTarget', 31, null, null, null);
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1',
+ $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1',
'file', $fileId2, 'myTarget', 31, null, null, null);
$user0 = $this->createMock(IUser::class);
@@ -1140,7 +1154,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId2)->willReturn([$file]);
- $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_USER, $file, -1, 0);
+ $share = $this->provider->getSharedWith('user0', IShare::TYPE_USER, $file, -1, 0);
$this->assertCount(1, $share);
$share = $share[0];
@@ -1149,7 +1163,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('user1', $share->getShareOwner());
$this->assertSame('user1', $share->getSharedBy());
$this->assertSame($file, $share->getNode());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
}
/**
@@ -1159,9 +1173,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
- $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1',
+ $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1',
'file', $fileId, 'myTarget', 31, null, null, null);
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1',
+ $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1',
'file', $fileId2, 'myTarget', 31, null, null, null);
$user0 = $this->createMock(IUser::class);
@@ -1181,7 +1195,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId2)->willReturn([$node]);
- $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0);
+ $share = $this->provider->getSharedWith('user0', IShare::TYPE_GROUP, $node, -1, 0);
$this->assertCount(1, $share);
$share = $share[0];
@@ -1190,15 +1204,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('user1', $share->getShareOwner());
$this->assertSame('user1', $share->getSharedBy());
$this->assertSame($node, $share->getNode());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
}
public function shareTypesProvider() {
return [
- [\OCP\Share::SHARE_TYPE_USER, false],
- [\OCP\Share::SHARE_TYPE_GROUP, false],
- [\OCP\Share::SHARE_TYPE_USER, true],
- [\OCP\Share::SHARE_TYPE_GROUP, true],
+ [IShare::TYPE_USER, false],
+ [IShare::TYPE_GROUP, false],
+ [IShare::TYPE_USER, true],
+ [IShare::TYPE_GROUP, true],
];
}
@@ -1261,7 +1275,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1276,7 +1290,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy2'),
@@ -1292,7 +1306,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
- $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0);
+ $share = $this->provider->getSharesBy('sharedBy', IShare::TYPE_USER, null, false, 1, 0);
$this->assertCount(1, $share);
/** @var IShare $share */
@@ -1301,7 +1315,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('shareOwner', $share->getShareOwner());
$this->assertEquals('sharedBy', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals(13, $share->getPermissions());
$this->assertEquals('myTarget', $share->getTarget());
}
@@ -1310,7 +1324,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1325,7 +1339,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1342,7 +1356,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
- $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0);
+ $share = $this->provider->getSharesBy('sharedBy', IShare::TYPE_USER, $file, false, 1, 0);
$this->assertCount(1, $share);
/** @var IShare $share */
@@ -1351,7 +1365,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('sharedWith', $share->getSharedWith());
$this->assertEquals('shareOwner', $share->getShareOwner());
$this->assertEquals('sharedBy', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals(13, $share->getPermissions());
$this->assertEquals('myTarget', $share->getTarget());
}
@@ -1360,7 +1374,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('shareOwner'),
@@ -1375,7 +1389,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith'),
'uid_owner' => $qb->expr()->literal('shareOwner'),
'uid_initiator' => $qb->expr()->literal('sharedBy'),
@@ -1392,7 +1406,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
- $shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0);
+ $shares = $this->provider->getSharesBy('shareOwner', IShare::TYPE_USER, null, true, -1, 0);
$this->assertCount(2, $shares);
/** @var IShare $share */
@@ -1401,7 +1415,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('sharedWith', $share->getSharedWith());
$this->assertSame('shareOwner', $share->getShareOwner());
$this->assertSame('shareOwner', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals(13, $share->getPermissions());
$this->assertEquals('myTarget', $share->getTarget());
@@ -1410,7 +1424,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('sharedWith', $share->getSharedWith());
$this->assertSame('shareOwner', $share->getShareOwner());
$this->assertSame('sharedBy', $share->getSharedBy());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals(0, $share->getPermissions());
$this->assertEquals('userTarget', $share->getTarget());
}
@@ -1419,7 +1433,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('group'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1475,7 +1489,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('group'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1550,7 +1564,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('group'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1595,7 +1609,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('group'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1633,7 +1647,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('user2'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1686,7 +1700,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('user2'),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
@@ -1729,7 +1743,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'uid_owner' => $qb->expr()->literal('user1'),
'uid_initiator' => $qb->expr()->literal('user1'),
'item_type' => $qb->expr()->literal('file'),
@@ -1759,7 +1773,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testUpdateUser() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user2',
+ $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
$users = [];
@@ -1817,7 +1831,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testUpdateLink() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_LINK, null, 'user1', 'user2',
+ $id = $this->addShareToDB(IShare::TYPE_LINK, null, 'user1', 'user2',
'file', 42, 'target', 31, null, null);
$users = [];
@@ -1877,7 +1891,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testUpdateLinkRemovePassword() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_LINK, 'foo', 'user1', 'user2',
+ $id = $this->addShareToDB(IShare::TYPE_LINK, 'foo', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
$qb = $this->dbConn->getQueryBuilder();
@@ -1940,7 +1954,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testUpdateGroupNoSub() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user2',
+ $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
$users = [];
@@ -2012,7 +2026,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testUpdateGroupSubShares() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user2',
+ $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
$id2 = $this->addShareToDB(2, 'user0', 'user1', 'user2',
@@ -2112,7 +2126,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testMoveUserShare() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1', 'file',
+ $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1', 'file',
42, 'mytaret', 31, null, null);
$user0 = $this->createMock(IUser::class);
@@ -2143,7 +2157,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
public function testMoveGroupShare() {
- $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1', 'file',
+ $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1', 'file',
42, 'mytaret', 31, null, null);
$user0 = $this->createMock(IUser::class);
@@ -2185,20 +2199,20 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function dataDeleteUser() {
return [
- [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'a', true],
- [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'b', false],
- [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'c', true],
- [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'd', false],
- [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'a', true],
- [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'b', false],
+ [IShare::TYPE_USER, 'a', 'b', 'c', 'a', true],
+ [IShare::TYPE_USER, 'a', 'b', 'c', 'b', false],
+ [IShare::TYPE_USER, 'a', 'b', 'c', 'c', true],
+ [IShare::TYPE_USER, 'a', 'b', 'c', 'd', false],
+ [IShare::TYPE_GROUP, 'a', 'b', 'c', 'a', true],
+ [IShare::TYPE_GROUP, 'a', 'b', 'c', 'b', false],
// The group c is still valid but user c is deleted so group share stays
- [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'c', false],
- [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'd', false],
- [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'a', true],
+ [IShare::TYPE_GROUP, 'a', 'b', 'c', 'c', false],
+ [IShare::TYPE_GROUP, 'a', 'b', 'c', 'd', false],
+ [IShare::TYPE_LINK, 'a', 'b', 'c', 'a', true],
// To avoid invisible link shares delete initiated link shares as well (see #22327)
- [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'b', true],
- [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'c', false],
- [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'd', false],
+ [IShare::TYPE_LINK, 'a', 'b', 'c', 'b', true],
+ [IShare::TYPE_LINK, 'a', 'b', 'c', 'c', false],
+ [IShare::TYPE_LINK, 'a', 'b', 'c', 'd', false],
];
}
@@ -2263,7 +2277,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function testDeleteUserGroup($owner, $initiator, $recipient, $deletedUser, $groupShareDeleted, $userGroupShareDeleted) {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
- ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))
+ ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))
->setValue('uid_owner', $qb->createNamedParameter($owner))
->setValue('uid_initiator', $qb->createNamedParameter($initiator))
->setValue('share_with', $qb->createNamedParameter('group'))
@@ -2285,7 +2299,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->execute();
$userGroupId = $qb->getLastInsertId();
- $this->provider->userDeleted($deletedUser, \OCP\Share::SHARE_TYPE_GROUP);
+ $this->provider->userDeleted($deletedUser, IShare::TYPE_GROUP);
$qb = $this->dbConn->getQueryBuilder();
$qb->select('*')
@@ -2314,28 +2328,28 @@ class DefaultShareProviderTest extends \Test\TestCase {
return [
[
[
- 'type' => \OCP\Share::SHARE_TYPE_USER,
+ 'type' => IShare::TYPE_USER,
'recipient' => 'user',
'children' => []
], 'group', false
],
[
[
- 'type' => \OCP\Share::SHARE_TYPE_USER,
+ 'type' => IShare::TYPE_USER,
'recipient' => 'user',
'children' => []
], 'user', false
],
[
[
- 'type' => \OCP\Share::SHARE_TYPE_LINK,
+ 'type' => IShare::TYPE_LINK,
'recipient' => 'user',
'children' => []
], 'group', false
],
[
[
- 'type' => \OCP\Share::SHARE_TYPE_GROUP,
+ 'type' => IShare::TYPE_GROUP,
'recipient' => 'group1',
'children' => [
'foo',
@@ -2345,7 +2359,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
],
[
[
- 'type' => \OCP\Share::SHARE_TYPE_GROUP,
+ 'type' => IShare::TYPE_GROUP,
'recipient' => 'group1',
'children' => [
'foo',
@@ -2426,7 +2440,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
public function testUserDeletedFromGroup($group, $user, $toDelete) {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
- ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))
+ ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))
->setValue('uid_owner', $qb->createNamedParameter('owner'))
->setValue('uid_initiator', $qb->createNamedParameter('initiator'))
->setValue('share_with', $qb->createNamedParameter('group1'))
@@ -2474,8 +2488,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
);
$password = md5(time());
@@ -2497,7 +2512,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u1->getUID())
->setSharedWith($u2->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share1 = $this->provider->create($share1);
@@ -2506,7 +2521,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u2->getUID())
->setSharedWith($u3->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share2 = $this->provider->create($share2);
@@ -2514,7 +2529,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share3->setNode($folder2)
->setSharedBy($u2->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share3 = $this->provider->create($share3);
@@ -2523,7 +2538,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u1->getUID())
->setSharedWith($g1->getGID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share4 = $this->provider->create($share4);
@@ -2539,14 +2554,14 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file_shares = $result[$file1->getId()];
$this->assertCount(1, $file_shares);
$this->assertSame($file1->getId(), $file_shares[0]->getNodeId());
- $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $file_shares[0]->getShareType());
+ $this->assertSame(IShare::TYPE_USER, $file_shares[0]->getShareType());
$folder_shares = $result[$folder2->getId()];
$this->assertCount(2, $folder_shares);
$this->assertSame($folder2->getId(), $folder_shares[0]->getNodeId());
$this->assertSame($folder2->getId(), $folder_shares[1]->getNodeId());
- $this->assertSame(\OCP\Share::SHARE_TYPE_LINK, $folder_shares[0]->getShareType());
- $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $folder_shares[1]->getShareType());
+ $this->assertSame(IShare::TYPE_LINK, $folder_shares[0]->getShareType());
+ $this->assertSame(IShare::TYPE_GROUP, $folder_shares[1]->getShareType());
$provider->delete($share1);
$provider->delete($share2);
@@ -2571,8 +2586,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
);
$u1 = $userManager->createUser('testShare1', 'test');
@@ -2600,7 +2616,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u1->getUID())
->setSharedWith($u2->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share1 = $this->provider->create($share1);
@@ -2609,7 +2625,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u2->getUID())
->setSharedWith($g1->getGID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share2 = $this->provider->create($share2);
@@ -2619,7 +2635,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share3->setNode($file1)
->setSharedBy($u3->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share3 = $this->provider->create($share3);
@@ -2628,7 +2644,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u3->getUID())
->setSharedWith($u5->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share4 = $this->provider->create($share4);
@@ -2666,8 +2682,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$rootFolder,
$this->mailer,
$this->defaults,
- $this->l10n,
- $this->urlGenerator
+ $this->l10nFactory,
+ $this->urlGenerator,
+ $this->config
);
$u1 = $userManager->createUser('testShare1', 'test');
@@ -2695,7 +2712,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u1->getUID())
->setSharedWith($u2->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share1 = $this->provider->create($share1);
@@ -2704,7 +2721,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u2->getUID())
->setSharedWith($g1->getGID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$share2 = $this->provider->create($share2);
@@ -2714,7 +2731,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share3->setNode($file1)
->setSharedBy($u3->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share3 = $this->provider->create($share3);
@@ -2723,7 +2740,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
->setSharedBy($u3->getUID())
->setSharedWith($u5->getUID())
->setShareOwner($u1->getUID())
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_READ);
$share4 = $this->provider->create($share4);
@@ -2753,7 +2770,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('sharedWith1'),
'uid_owner' => $qb->expr()->literal('shareOwner1'),
'uid_initiator' => $qb->expr()->literal('sharedBy1'),
@@ -2768,7 +2785,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP),
'share_with' => $qb->expr()->literal('sharedWith2'),
'uid_owner' => $qb->expr()->literal('shareOwner2'),
'uid_initiator' => $qb->expr()->literal('sharedBy2'),
@@ -2783,7 +2800,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'token' => $qb->expr()->literal('token3'),
'uid_owner' => $qb->expr()->literal('shareOwner3'),
'uid_initiator' => $qb->expr()->literal('sharedBy3'),
@@ -2798,7 +2815,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_EMAIL),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_EMAIL),
'share_with' => $qb->expr()->literal('shareOwner4'),
'token' => $qb->expr()->literal('token4'),
'uid_owner' => $qb->expr()->literal('shareOwner4'),
@@ -2814,7 +2831,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'token' => $qb->expr()->literal('token5'),
'uid_owner' => $qb->expr()->literal('shareOwner5'),
'uid_initiator' => $qb->expr()->literal('sharedBy5'),
@@ -2867,7 +2884,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
// We fetch the node so the root folder is eventually called
$this->assertEquals($id1, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_USER, $share->getShareType());
$this->assertEquals('sharedWith1', $share->getSharedWith());
$this->assertEquals('sharedBy1', $share->getSharedBy());
$this->assertEquals('shareOwner1', $share->getShareOwner());
@@ -2879,7 +2896,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $shares[1];
$this->assertEquals($id2, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType());
$this->assertEquals('sharedWith2', $share->getSharedWith());
$this->assertEquals('sharedBy2', $share->getSharedBy());
$this->assertEquals('shareOwner2', $share->getShareOwner());
@@ -2891,7 +2908,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $shares[2];
$this->assertEquals($id3, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_LINK, $share->getShareType());
$this->assertEquals(null, $share->getSharedWith());
$this->assertEquals('sharedBy3', $share->getSharedBy());
$this->assertEquals('shareOwner3', $share->getShareOwner());
@@ -2903,7 +2920,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $shares[3];
$this->assertEquals($id5, $share->getId());
- $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType());
+ $this->assertEquals(IShare::TYPE_LINK, $share->getShareType());
$this->assertEquals(null, $share->getSharedWith());
$this->assertEquals('sharedBy5', $share->getSharedBy());
$this->assertEquals('shareOwner5', $share->getShareOwner());
diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php
index 2b062e592ba..66dbafe7691 100644
--- a/tests/lib/Share20/LegacyHooksTest.php
+++ b/tests/lib/Share20/LegacyHooksTest.php
@@ -27,6 +27,7 @@ use OC\Share20\LegacyHooks;
use OC\Share20\Manager;
use OCP\Constants;
use OCP\Files\File;
+use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
@@ -57,7 +58,7 @@ class LegacyHooksTest extends TestCase {
$share = $this->manager->newShare();
$share->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -70,7 +71,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'awesomeUser',
'itemparent' => null,
'uidOwner' => 'sharedBy',
@@ -94,7 +95,7 @@ class LegacyHooksTest extends TestCase {
$share = $this->manager->newShare();
$share->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -107,7 +108,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'awesomeUser',
'itemparent' => null,
'uidOwner' => 'sharedBy',
@@ -118,7 +119,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'awesomeUser',
'itemparent' => null,
'uidOwner' => 'sharedBy',
@@ -145,7 +146,7 @@ class LegacyHooksTest extends TestCase {
$share = $this->manager->newShare();
$share->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -158,7 +159,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'awesomeUser',
'itemparent' => null,
'uidOwner' => 'sharedBy',
@@ -170,7 +171,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'awesomeUser',
'itemparent' => null,
'uidOwner' => 'sharedBy',
@@ -197,7 +198,7 @@ class LegacyHooksTest extends TestCase {
$date = new \DateTime();
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $share->setShareType(IShare::TYPE_LINK)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -217,7 +218,7 @@ class LegacyHooksTest extends TestCase {
$expected = [
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_LINK,
+ 'shareType' => IShare::TYPE_LINK,
'shareWith' => 'awesomeUser',
'uidOwner' => 'sharedBy',
'fileSource' => 1,
@@ -245,7 +246,7 @@ class LegacyHooksTest extends TestCase {
$date = new \DateTime();
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $share->setShareType(IShare::TYPE_LINK)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -265,7 +266,7 @@ class LegacyHooksTest extends TestCase {
$expected = [
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_LINK,
+ 'shareType' => IShare::TYPE_LINK,
'shareWith' => 'awesomeUser',
'uidOwner' => 'sharedBy',
'fileSource' => 1,
@@ -301,7 +302,7 @@ class LegacyHooksTest extends TestCase {
$share = $this->manager->newShare();
$share->setId(42)
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setSharedWith('awesomeUser')
->setSharedBy('sharedBy')
->setNode($path)
@@ -319,7 +320,7 @@ class LegacyHooksTest extends TestCase {
'id' => 42,
'itemType' => 'file',
'itemSource' => 1,
- 'shareType' => \OCP\Share::SHARE_TYPE_LINK,
+ 'shareType' => IShare::TYPE_LINK,
'shareWith' => 'awesomeUser',
'uidOwner' => 'sharedBy',
'fileSource' => 1,
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index e66ac51aeea..58f96c418b8 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -194,10 +194,10 @@ class ManagerTest extends \Test\TestCase {
$group->method('getGID')->willReturn('sharedWithGroup');
return [
- [\OCP\Share::SHARE_TYPE_USER, 'sharedWithUser'],
- [\OCP\Share::SHARE_TYPE_GROUP, 'sharedWithGroup'],
- [\OCP\Share::SHARE_TYPE_LINK, ''],
- [\OCP\Share::SHARE_TYPE_REMOTE, 'foo@bar.com'],
+ [IShare::TYPE_USER, 'sharedWithUser'],
+ [IShare::TYPE_GROUP, 'sharedWithGroup'],
+ [IShare::TYPE_LINK, ''],
+ [IShare::TYPE_REMOTE, 'foo@bar.com'],
];
}
@@ -257,7 +257,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('sharedWith')
->setSharedBy('sharedBy')
->setShareOwner('shareOwner')
@@ -306,7 +306,7 @@ class ManagerTest extends \Test\TestCase {
$share1 = $this->manager->newShare();
$share1->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('sharedWith1')
->setSharedBy('sharedBy1')
->setNode($path)
@@ -315,7 +315,7 @@ class ManagerTest extends \Test\TestCase {
$share2 = $this->manager->newShare();
$share2->setId(43)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setSharedWith('sharedWith2')
->setSharedBy('sharedBy2')
->setNode($path)
@@ -325,7 +325,7 @@ class ManagerTest extends \Test\TestCase {
$share3 = $this->manager->newShare();
$share3->setId(44)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setSharedBy('sharedBy3')
->setNode($path)
->setTarget('myTarget3')
@@ -373,7 +373,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setId(42)
->setProviderId('prov')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('sharedWith')
->setSharedBy('sharedBy')
->setShareOwner('shareOwner')
@@ -404,14 +404,14 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$share = $this->createMock(IShare::class);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
+ $share->method('getShareType')->willReturn(IShare::TYPE_USER);
$child1 = $this->createMock(IShare::class);
- $child1->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
+ $child1->method('getShareType')->willReturn(IShare::TYPE_USER);
$child2 = $this->createMock(IShare::class);
- $child2->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
+ $child2->method('getShareType')->willReturn(IShare::TYPE_USER);
$child3 = $this->createMock(IShare::class);
- $child3->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
+ $child3->method('getShareType')->willReturn(IShare::TYPE_USER);
$shares = [
$child1,
@@ -463,7 +463,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setExpirationDate($date)
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK);
+ ->setShareType(IShare::TYPE_LINK);
$this->defaultProvider->expects($this->once())
->method('getShareById')
@@ -572,30 +572,30 @@ class ManagerTest extends \Test\TestCase {
->willReturn($storage);
$data = [
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true],
+ [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
+ [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
[$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unknown share type', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true],
+ [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true],
+ [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Can’t share with yourself', true],
+ [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Can’t share with yourself', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true],
+ [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true],
+ [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
- [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, IShare::TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
+ [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true],
];
$nonShareAble = $this->createMock(Folder::class);
@@ -606,66 +606,69 @@ class ManagerTest extends \Test\TestCase {
$nonShareAble->method('getStorage')
->willReturn($storage);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
$limitedPermssions = $this->createMock(File::class);
$limitedPermssions->method('isShareable')->willReturn(true);
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+ $limitedPermssions->method('getId')->willReturn(108);
$limitedPermssions->method('getPath')->willReturn('path');
$limitedPermssions->method('getOwner')
->willReturn($owner);
$limitedPermssions->method('getStorage')
->willReturn($storage);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true];
$mount = $this->createMock(MoveableMount::class);
$limitedPermssions->method('getMountPoint')->willReturn($mount);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Can’t increase permissions of path', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Can’t increase permissions of path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Can’t increase permissions of path', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Can’t increase permissions of path', true];
$nonMoveableMountPermssions = $this->createMock(Folder::class);
$nonMoveableMountPermssions->method('isShareable')->willReturn(true);
$nonMoveableMountPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+ $nonMoveableMountPermssions->method('getId')->willReturn(108);
$nonMoveableMountPermssions->method('getPath')->willReturn('path');
$nonMoveableMountPermssions->method('getOwner')
->willReturn($owner);
$nonMoveableMountPermssions->method('getStorage')
->willReturn($storage);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false];
$rootFolder = $this->createMock(Folder::class);
$rootFolder->method('isShareable')->willReturn(true);
$rootFolder->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL);
$rootFolder->method('getId')->willReturn(42);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You can’t share your root folder', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You can’t share your root folder', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You can’t share your root folder', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You can’t share your root folder', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You can’t share your root folder', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You can’t share your root folder', true];
$allPermssions = $this->createMock(Folder::class);
$allPermssions->method('isShareable')->willReturn(true);
$allPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL);
+ $allPermssions->method('getId')->willReturn(108);
$allPermssions->method('getOwner')
->willReturn($owner);
$allPermssions->method('getStorage')
->willReturn($storage);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false];
+ $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false];
+ $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false];
+ $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false];
$remoteStorage = $this->createMock(Storage\IStorage::class);
@@ -675,13 +678,14 @@ class ManagerTest extends \Test\TestCase {
$remoteFile = $this->createMock(Folder::class);
$remoteFile->method('isShareable')->willReturn(true);
$remoteFile->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ ^ \OCP\Constants::PERMISSION_UPDATE);
+ $remoteFile->method('getId')->willReturn(108);
$remoteFile->method('getOwner')
->willReturn($owner);
$remoteFile->method('getStorage')
->willReturn($storage);
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 1, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 3, null, null), null, false];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of ', true];
+ $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 1, null, null), null, false];
+ $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 3, null, null), null, false];
+ $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of ', true];
return $data;
}
@@ -709,6 +713,11 @@ class ManagerTest extends \Test\TestCase {
$userFolder->expects($this->any())
->method('getId')
->willReturn(42);
+ // Id 108 is used in the data to refer to the node of the share.
+ $userFolder->expects($this->any())
+ ->method('getById')
+ ->with(108)
+ ->willReturn([$share->getNode()]);
$userFolder->expects($this->any())
->method('getRelativePath')
->willReturnArgument(0);
@@ -747,7 +756,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ $share->setShareType(IShare::TYPE_USER)
->setSharedWith('user0')
->setSharedBy('user1')
->setNode($userFolder);
@@ -1118,7 +1127,7 @@ class ManagerTest extends \Test\TestCase {
->setId('bar');
$share2 = $this->manager->newShare();
- $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $share2->setShareType(IShare::TYPE_GROUP)
->setShareOwner('shareOwner2')
->setProviderId('foo')
->setId('baz')
@@ -1156,7 +1165,7 @@ class ManagerTest extends \Test\TestCase {
->setId('bar');
$share2 = $this->manager->newShare();
- $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $share2->setShareType(IShare::TYPE_GROUP)
->setShareOwner('shareOwner2')
->setProviderId('foo')
->setId('baz')
@@ -1185,7 +1194,7 @@ class ManagerTest extends \Test\TestCase {
$this->userManager->method('get')->with('sharedWith')->willReturn($sharedWith);
$share2 = $this->manager->newShare();
- $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $share2->setShareType(IShare::TYPE_GROUP)
->setShareOwner('shareOwner2')
->setProviderId('foo')
->setId('baz');
@@ -1598,7 +1607,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->createShare(
null,
- \OCP\Share::SHARE_TYPE_USER,
+ IShare::TYPE_USER,
$path,
'sharedWith',
'sharedBy',
@@ -1653,7 +1662,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->createShare(
null,
- \OCP\Share::SHARE_TYPE_GROUP,
+ IShare::TYPE_GROUP,
$path,
'sharedWith',
'sharedBy',
@@ -1718,7 +1727,7 @@ class ManagerTest extends \Test\TestCase {
$date = new \DateTime();
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $share->setShareType(IShare::TYPE_LINK)
->setNode($path)
->setSharedBy('sharedBy')
->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1776,7 +1785,7 @@ class ManagerTest extends \Test\TestCase {
/** @var IShare $share */
$share = $e->getSubject();
- return $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK &&
+ return $share->getShareType() === IShare::TYPE_LINK &&
$share->getNode() === $path &&
$share->getSharedBy() === 'sharedBy' &&
$share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
@@ -1795,7 +1804,7 @@ class ManagerTest extends \Test\TestCase {
/** @var IShare $share */
$share = $e->getSubject();
- return $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK &&
+ return $share->getShareType() === IShare::TYPE_LINK &&
$share->getNode() === $path &&
$share->getSharedBy() === 'sharedBy' &&
$share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
@@ -1841,7 +1850,7 @@ class ManagerTest extends \Test\TestCase {
$path->method('getStorage')->willReturn($storage);
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $share->setShareType(IShare::TYPE_EMAIL)
->setNode($path)
->setSharedBy('sharedBy')
->setPermissions(\OCP\Constants::PERMISSION_ALL);
@@ -1886,7 +1895,7 @@ class ManagerTest extends \Test\TestCase {
/** @var IShare $share */
$share = $e->getSubject();
- return $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL &&
+ return $share->getShareType() === IShare::TYPE_EMAIL &&
$share->getNode() === $path &&
$share->getSharedBy() === 'sharedBy' &&
$share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
@@ -1905,7 +1914,7 @@ class ManagerTest extends \Test\TestCase {
/** @var IShare $share */
$share = $e->getSubject();
- return $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL &&
+ return $share->getShareType() === IShare::TYPE_EMAIL &&
$share->getNode() === $path &&
$share->getSharedBy() === 'sharedBy' &&
$share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
@@ -1950,7 +1959,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->createShare(
null,
- \OCP\Share::SHARE_TYPE_USER,
+ IShare::TYPE_USER,
$path,
'sharedWith',
'sharedBy',
@@ -2030,7 +2039,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->createShare(
null,
- \OCP\Share::SHARE_TYPE_USER,
+ IShare::TYPE_USER,
$path,
'sharedWith',
'sharedBy',
@@ -2078,14 +2087,14 @@ class ManagerTest extends \Test\TestCase {
->method('getSharesBy')
->with(
$this->equalTo('user'),
- $this->equalTo(\OCP\Share::SHARE_TYPE_USER),
+ $this->equalTo(IShare::TYPE_USER),
$this->equalTo($node),
$this->equalTo(true),
$this->equalTo(1),
$this->equalTo(1)
)->willReturn([$share]);
- $shares = $this->manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_USER, $node, true, 1, 1);
+ $shares = $this->manager->getSharesBy('user', IShare::TYPE_USER, $node, true, 1, 1);
$this->assertCount(1, $shares);
$this->assertSame($share, $shares[0]);
@@ -2157,7 +2166,7 @@ class ManagerTest extends \Test\TestCase {
}
});
- $res = $manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_LINK, $node, true, 3, 0);
+ $res = $manager->getSharesBy('user', IShare::TYPE_LINK, $node, true, 3, 0);
$this->assertCount(3, $res);
$this->assertEquals($shares[0]->getId(), $res[0]->getId());
@@ -2204,7 +2213,7 @@ class ManagerTest extends \Test\TestCase {
$factory->expects($this->once())
->method('getProviderForType')
- ->with(\OCP\Share::SHARE_TYPE_LINK)
+ ->with(IShare::TYPE_LINK)
->willReturn($this->defaultProvider);
$this->defaultProvider->expects($this->once())
@@ -2251,7 +2260,7 @@ class ManagerTest extends \Test\TestCase {
$factory->expects($this->any())
->method('getProviderForType')
->willReturnCallback(function ($shareType) use ($roomShareProvider) {
- if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) {
+ if ($shareType !== IShare::TYPE_ROOM) {
throw new Exception\ProviderException();
}
@@ -2299,11 +2308,11 @@ class ManagerTest extends \Test\TestCase {
$factory->expects($this->at(0))
->method('getProviderForType')
- ->with(\OCP\Share::SHARE_TYPE_LINK)
+ ->with(IShare::TYPE_LINK)
->willReturn($this->defaultProvider);
$factory->expects($this->at(1))
->method('getProviderForType')
- ->with(\OCP\Share::SHARE_TYPE_REMOTE)
+ ->with(IShare::TYPE_REMOTE)
->willReturn($this->defaultProvider);
$this->defaultProvider->expects($this->at(0))
@@ -2398,7 +2407,7 @@ class ManagerTest extends \Test\TestCase {
->willReturn('yes');
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $share->setShareType(IShare::TYPE_LINK)
->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
$this->config
@@ -2420,13 +2429,13 @@ class ManagerTest extends \Test\TestCase {
public function testCheckPasswordNoLinkShare() {
$share = $this->createMock(IShare::class);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
+ $share->method('getShareType')->willReturn(IShare::TYPE_USER);
$this->assertFalse($this->manager->checkPassword($share, 'password'));
}
public function testCheckPasswordNoPassword() {
$share = $this->createMock(IShare::class);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK);
+ $share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$this->assertFalse($this->manager->checkPassword($share, 'password'));
$share->method('getPassword')->willReturn('password');
@@ -2435,7 +2444,7 @@ class ManagerTest extends \Test\TestCase {
public function testCheckPasswordInvalidPassword() {
$share = $this->createMock(IShare::class);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK);
+ $share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$share->method('getPassword')->willReturn('password');
$this->hasher->method('verify')->with('invalidpassword', 'password', '')->willReturn(false);
@@ -2445,7 +2454,7 @@ class ManagerTest extends \Test\TestCase {
public function testCheckPasswordValidPassword() {
$share = $this->createMock(IShare::class);
- $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK);
+ $share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$share->method('getPassword')->willReturn('passwordHash');
$this->hasher->method('verify')->with('password', 'passwordHash', '')->willReturn(true);
@@ -2455,7 +2464,7 @@ class ManagerTest extends \Test\TestCase {
public function testCheckPasswordUpdateShare() {
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $share->setShareType(IShare::TYPE_LINK)
->setPassword('passwordHash');
$this->hasher->method('verify')->with('password', 'passwordHash', '')
@@ -2487,7 +2496,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
+ $originalShare->setShareType(IShare::TYPE_GROUP);
$manager->expects($this->once())->method('canShare')->willReturn(true);
$manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare);
@@ -2495,7 +2504,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER);
+ ->setShareType(IShare::TYPE_USER);
$manager->updateShare($share);
}
@@ -2513,7 +2522,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $originalShare->setShareType(IShare::TYPE_GROUP)
->setSharedWith('origGroup');
$manager->expects($this->once())->method('canShare')->willReturn(true);
@@ -2522,7 +2531,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setSharedWith('newGroup');
$manager->updateShare($share);
@@ -2541,7 +2550,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ $originalShare->setShareType(IShare::TYPE_USER)
->setSharedWith('sharedWith');
$manager->expects($this->once())->method('canShare')->willReturn(true);
@@ -2550,7 +2559,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('newUser')
->setShareOwner('newUser');
@@ -2571,7 +2580,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ $originalShare->setShareType(IShare::TYPE_USER)
->setSharedWith('origUser')
->setPermissions(1);
@@ -2585,7 +2594,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setSharedWith('origUser')
->setShareOwner('newUser')
->setSharedBy('sharer')
@@ -2609,7 +2618,7 @@ class ManagerTest extends \Test\TestCase {
$hookListner2->expects($this->once())->method('post')->with([
'itemType' => 'file',
'itemSource' => 100,
- 'shareType' => \OCP\Share::SHARE_TYPE_USER,
+ 'shareType' => IShare::TYPE_USER,
'shareWith' => 'origUser',
'uidOwner' => 'sharer',
'permissions' => 31,
@@ -2631,7 +2640,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $originalShare->setShareType(IShare::TYPE_GROUP)
->setSharedWith('origUser')
->setPermissions(31);
@@ -2643,7 +2652,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ ->setShareType(IShare::TYPE_GROUP)
->setSharedWith('origUser')
->setShareOwner('owner')
->setNode($node)
@@ -2679,7 +2688,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $originalShare->setShareType(IShare::TYPE_LINK)
->setPermissions(15);
$tomorrow = new \DateTime();
@@ -2692,7 +2701,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -2760,7 +2769,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ $originalShare->setShareType(IShare::TYPE_LINK)
->setPermissions(15);
$tomorrow = new \DateTime();
@@ -2773,7 +2782,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setShareType(IShare::TYPE_LINK)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -2826,7 +2835,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL);
$tomorrow = new \DateTime();
@@ -2839,7 +2848,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -2901,7 +2910,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword(null)
->setSendPasswordByTalk(false);
@@ -2916,7 +2925,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -2979,7 +2988,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('anotherPasswordHash')
->setSendPasswordByTalk(false);
@@ -2994,7 +3003,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3065,7 +3074,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword(null)
->setSendPasswordByTalk(false);
@@ -3080,7 +3089,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3137,7 +3146,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('passwordHash')
->setSendPasswordByTalk(false);
@@ -3152,7 +3161,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3209,7 +3218,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('passwordHash')
->setSendPasswordByTalk(false);
@@ -3224,7 +3233,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3281,7 +3290,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('passwordHash')
->setSendPasswordByTalk(false);
@@ -3296,7 +3305,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3357,7 +3366,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('passwordHash')
->setSendPasswordByTalk(true);
@@ -3372,7 +3381,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3433,7 +3442,7 @@ class ManagerTest extends \Test\TestCase {
->getMock();
$originalShare = $this->manager->newShare();
- $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ $originalShare->setShareType(IShare::TYPE_EMAIL)
->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setPassword('passwordHash')
->setSendPasswordByTalk(true);
@@ -3448,7 +3457,7 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$share->setProviderId('foo')
->setId('42')
- ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL)
+ ->setShareType(IShare::TYPE_EMAIL)
->setToken('token')
->setSharedBy('owner')
->setShareOwner('owner')
@@ -3495,7 +3504,7 @@ class ManagerTest extends \Test\TestCase {
$this->expectExceptionMessage('Can’t change target of link share');
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_LINK);
+ $share->setShareType(IShare::TYPE_LINK);
$recipient = $this->createMock(IUser::class);
@@ -3508,7 +3517,7 @@ class ManagerTest extends \Test\TestCase {
$this->expectExceptionMessage('Invalid recipient');
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_USER);
+ $share->setShareType(IShare::TYPE_USER);
$share->setSharedWith('sharedWith');
@@ -3517,7 +3526,7 @@ class ManagerTest extends \Test\TestCase {
public function testMoveShareUser() {
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ $share->setShareType(IShare::TYPE_USER)
->setId('42')
->setProviderId('foo');
@@ -3535,7 +3544,7 @@ class ManagerTest extends \Test\TestCase {
$this->expectExceptionMessage('Invalid recipient');
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
+ $share->setShareType(IShare::TYPE_GROUP);
$sharedWith = $this->createMock(IGroup::class);
$share->setSharedWith('shareWith');
@@ -3555,7 +3564,7 @@ class ManagerTest extends \Test\TestCase {
$this->expectExceptionMessage('Group "shareWith" does not exist');
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
+ $share->setShareType(IShare::TYPE_GROUP);
$share->setSharedWith('shareWith');
$recipient = $this->createMock(IUser::class);
@@ -3568,7 +3577,7 @@ class ManagerTest extends \Test\TestCase {
public function testMoveShareGroup() {
$share = $this->manager->newShare();
- $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP)
+ $share->setShareType(IShare::TYPE_GROUP)
->setId('42')
->setProviderId('foo');
@@ -3594,7 +3603,7 @@ class ManagerTest extends \Test\TestCase {
$factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock();
$factory->expects($this->any())->method('getProviderForType')
->willReturnCallback(function ($id) {
- if ($id === \OCP\Share::SHARE_TYPE_USER) {
+ if ($id === IShare::TYPE_USER) {
return true;
}
throw new Exception\ProviderException();
@@ -3625,7 +3634,7 @@ class ManagerTest extends \Test\TestCase {
public function dataTestShareProviderExists() {
return [
- [\OCP\Share::SHARE_TYPE_USER, true],
+ [IShare::TYPE_USER, true],
[42, false],
];
}
diff --git a/tests/lib/Share20/ShareHelperTest.php b/tests/lib/Share20/ShareHelperTest.php
index d2f5cd79284..b3e76735aaa 100644
--- a/tests/lib/Share20/ShareHelperTest.php
+++ b/tests/lib/Share20/ShareHelperTest.php
@@ -31,7 +31,7 @@ use Test\TestCase;
class ShareHelperTest extends TestCase {
- /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
private $manager;
/** @var ShareHelper */
@@ -77,9 +77,9 @@ class ShareHelperTest extends TestCase {
'remote' => $remoteList,
]);
- /** @var Node|\PHPUnit_Framework_MockObject_MockObject $node */
+ /** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
- /** @var ShareHelper|\PHPUnit_Framework_MockObject_MockObject $helper */
+ /** @var ShareHelper|\PHPUnit\Framework\MockObject\MockObject $helper */
$helper = $this->getMockBuilder(ShareHelper::class)
->setConstructorArgs([$this->manager])
->setMethods(['getPathsForUsers', 'getPathsForRemotes'])
@@ -128,7 +128,7 @@ class ShareHelperTest extends TestCase {
public function testGetPathsForUsers(array $users, array $nodes, array $expected) {
$lastNode = null;
foreach ($nodes as $nodeId => $nodeName) {
- /** @var Node|\PHPUnit_Framework_MockObject_MockObject $node */
+ /** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
$node->expects($this->any())
->method('getId')
@@ -185,7 +185,7 @@ class ShareHelperTest extends TestCase {
public function testGetPathsForRemotes(array $remotes, array $nodes, array $expected) {
$lastNode = null;
foreach ($nodes as $nodeId => $nodePath) {
- /** @var Node|\PHPUnit_Framework_MockObject_MockObject $node */
+ /** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
$node->expects($this->any())
->method('getId')
@@ -221,7 +221,7 @@ class ShareHelperTest extends TestCase {
* @param string $expected
*/
public function testGetMountedPath($path, $expected) {
- /** @var Node|\PHPUnit_Framework_MockObject_MockObject $node */
+ /** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
$node->expects($this->once())
->method('getPath')
diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php
index f7ea479350d..7d4dc6de2d6 100644
--- a/tests/lib/Share20/ShareTest.php
+++ b/tests/lib/Share20/ShareTest.php
@@ -31,7 +31,7 @@ use OCP\IUserManager;
*/
class ShareTest extends \Test\TestCase {
- /** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */
protected $rootFolder;
/** @var \OCP\Share\IShare */
protected $share;
@@ -42,7 +42,7 @@ class ShareTest extends \Test\TestCase {
$this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
}
-
+
public function testSetIdInvalid() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('String expected.');
@@ -61,7 +61,7 @@ class ShareTest extends \Test\TestCase {
$this->assertEquals('foo', $this->share->getId());
}
-
+
public function testSetIdOnce() {
$this->expectException(\OCP\Share\Exceptions\IllegalIDChangeException::class);
$this->expectExceptionMessage('Not allowed to assign a new internal id to a share');
@@ -70,7 +70,7 @@ class ShareTest extends \Test\TestCase {
$this->share->setId('bar');
}
-
+
public function testSetProviderIdInt() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('String expected.');
@@ -85,7 +85,7 @@ class ShareTest extends \Test\TestCase {
$this->assertEquals('foo:bar', $this->share->getFullId());
}
-
+
public function testSetProviderIdOnce() {
$this->expectException(\OCP\Share\Exceptions\IllegalIDChangeException::class);
$this->expectExceptionMessage('Not allowed to assign a new provider id to a share');
diff --git a/tests/lib/Support/CrashReport/RegistryTest.php b/tests/lib/Support/CrashReport/RegistryTest.php
index d85b006509e..f88902d7065 100644
--- a/tests/lib/Support/CrashReport/RegistryTest.php
+++ b/tests/lib/Support/CrashReport/RegistryTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@@ -26,6 +28,8 @@ namespace Test\Support\CrashReport;
use Exception;
use OC\Support\CrashReport\Registry;
+use OCP\AppFramework\QueryException;
+use OCP\IServerContainer;
use OCP\Support\CrashReport\ICollectBreadcrumbs;
use OCP\Support\CrashReport\IMessageReporter;
use OCP\Support\CrashReport\IReporter;
@@ -33,26 +37,60 @@ use Test\TestCase;
class RegistryTest extends TestCase {
+ /** @var IServerContainer|\PHPUnit\Framework\MockObject\MockObject */
+ private $serverContainer;
+
/** @var Registry */
private $registry;
protected function setUp(): void {
parent::setUp();
- $this->registry = new Registry();
+ $this->serverContainer = $this->createMock(IServerContainer::class);
+
+ $this->registry = new Registry(
+ $this->serverContainer
+ );
}
/**
* Doesn't assert anything, just checks whether anything "explodes"
*/
- public function testDelegateToNone() {
+ public function testDelegateToNone(): void {
$exception = new Exception('test');
$this->registry->delegateReport($exception);
$this->addToAssertionCount(1);
}
- public function testDelegateBreadcrumbCollection() {
+ public function testRegisterLazyCantLoad(): void {
+ $reporterClass = '\OCA\MyApp\Reporter';
+ $reporter = $this->createMock(IReporter::class);
+ $this->serverContainer->expects($this->once())
+ ->method('query')
+ ->with($reporterClass)
+ ->willReturn($reporter);
+ $reporter->expects($this->once())
+ ->method('report');
+ $exception = new Exception('test');
+
+ $this->registry->registerLazy($reporterClass);
+ $this->registry->delegateReport($exception);
+ }
+
+ public function testRegisterLazy(): void {
+ $reporterClass = '\OCA\MyApp\Reporter';
+ $this->serverContainer->expects($this->once())
+ ->method('query')
+ ->with($reporterClass)
+ ->willThrowException(new QueryException());
+ $exception = new Exception('test');
+
+ $this->registry->registerLazy($reporterClass);
+ $this->registry->delegateReport($exception);
+ }
+
+ public function testDelegateBreadcrumbCollection(): void {
$reporter1 = $this->createMock(IReporter::class);
$reporter2 = $this->createMock(ICollectBreadcrumbs::class);
$message = 'hello';
@@ -66,7 +104,7 @@ class RegistryTest extends TestCase {
$this->registry->delegateBreadcrumb($message, $category);
}
- public function testDelegateToAll() {
+ public function testDelegateToAll(): void {
$reporter1 = $this->createMock(IReporter::class);
$reporter2 = $this->createMock(IReporter::class);
$exception = new Exception('test');
@@ -82,7 +120,7 @@ class RegistryTest extends TestCase {
$this->registry->delegateReport($exception);
}
- public function testDelegateMessage() {
+ public function testDelegateMessage(): void {
$reporter1 = $this->createMock(IReporter::class);
$reporter2 = $this->createMock(IMessageReporter::class);
$message = 'hello';
diff --git a/tests/lib/Support/Subscription/DummySubscription.php b/tests/lib/Support/Subscription/DummySubscription.php
new file mode 100644
index 00000000000..e1f7f5c6b61
--- /dev/null
+++ b/tests/lib/Support/Subscription/DummySubscription.php
@@ -0,0 +1,58 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @author Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\Support\Subscription;
+
+class DummySubscription implements \OCP\Support\Subscription\ISubscription {
+
+ /** @var bool */
+ private $hasValidSubscription;
+ /** @var bool */
+ private $hasExtendedSupport;
+
+ /**
+ * DummySubscription constructor.
+ *
+ * @param bool $hasValidSubscription
+ * @param bool $hasExtendedSupport
+ */
+ public function __construct(bool $hasValidSubscription, bool $hasExtendedSupport) {
+ $this->hasValidSubscription = $hasValidSubscription;
+ $this->hasExtendedSupport = $hasExtendedSupport;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function hasValidSubscription(): bool {
+ return $this->hasValidSubscription;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function hasExtendedSupport(): bool {
+ return $this->hasExtendedSupport;
+ }
+}
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php
index 3e316792682..c070f69ae66 100644
--- a/tests/lib/Support/Subscription/RegistryTest.php
+++ b/tests/lib/Support/Subscription/RegistryTest.php
@@ -24,6 +24,7 @@ namespace Test\Support\Subscription;
use OC\Support\Subscription\Registry;
use OCP\IConfig;
+use OCP\IServerContainer;
use OCP\Support\Subscription\ISubscription;
use OCP\Support\Subscription\ISupportedApps;
use PHPUnit\Framework\MockObject\MockObject;
@@ -37,11 +38,15 @@ class RegistryTest extends TestCase {
/** @var MockObject|IConfig */
private $config;
+ /** @var MockObject|IServerContainer */
+ private $serverContainer;
+
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
- $this->registry = new Registry($this->config);
+ $this->serverContainer = $this->createMock(IServerContainer::class);
+ $this->registry = new Registry($this->config, $this->serverContainer);
}
/**
@@ -52,7 +57,7 @@ class RegistryTest extends TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testDoubleRegistration() {
$this->expectException(\OCP\Support\Subscription\Exception\AlreadyRegisteredException::class);
@@ -70,7 +75,7 @@ class RegistryTest extends TestCase {
}
public function testDelegateHasValidSubscription() {
- /* @var ISubscription|\PHPUnit_Framework_MockObject_MockObject $subscription */
+ /* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);
$subscription->expects($this->once())
->method('hasValidSubscription')
@@ -81,7 +86,7 @@ class RegistryTest extends TestCase {
}
public function testDelegateHasValidSubscriptionConfig() {
- /* @var ISubscription|\PHPUnit_Framework_MockObject_MockObject $subscription */
+ /* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('has_valid_subscription')
@@ -91,7 +96,7 @@ class RegistryTest extends TestCase {
}
public function testDelegateHasExtendedSupport() {
- /* @var ISubscription|\PHPUnit_Framework_MockObject_MockObject $subscription */
+ /* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);
$subscription->expects($this->once())
->method('hasExtendedSupport')
@@ -103,7 +108,7 @@ class RegistryTest extends TestCase {
public function testDelegateGetSupportedApps() {
- /* @var ISupportedApps|\PHPUnit_Framework_MockObject_MockObject $subscription */
+ /* @var ISupportedApps|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISupportedApps::class);
$subscription->expects($this->once())
->method('getSupportedApps')
@@ -112,4 +117,14 @@ class RegistryTest extends TestCase {
$this->assertSame(['abc'], $this->registry->delegateGetSupportedApps());
}
+
+ public function testSubscriptionService() {
+ $this->serverContainer->method('query')
+ ->with(DummySubscription::class)
+ ->willReturn(new DummySubscription(true, false));
+ $this->registry->registerService(DummySubscription::class);
+
+ $this->assertTrue($this->registry->delegateHasValidSubscription());
+ $this->assertFalse($this->registry->delegateHasExtendedSupport());
+ }
}
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index fd6283d2f27..69c2833433d 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -286,39 +286,4 @@ class TagsTest extends \Test\TestCase {
$this->assertTrue($tagger->removeFromFavorites(1));
$this->assertEquals([], $tagger->getFavorites());
}
-
- public function testShareTags() {
- $testTag = 'TestTag';
- \OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
-
- $tagger = $this->tagMgr->load('test');
- $tagger->tagAs(1, $testTag);
-
-
- $otherUserId = $this->getUniqueID('user2_');
- $otherUser = $this->createMock(IUser::class);
- $otherUser->method('getUID')
- ->willReturn($otherUserId);
-
- \OC::$server->getUserManager()->createUser($otherUserId, 'pass');
- \OC_User::setUserId($otherUserId);
- $otherUserSession = $this->createMock(IUserSession::class);
- $otherUserSession
- ->expects($this->any())
- ->method('getUser')
- ->willReturn($otherUser);
-
- $otherTagMgr = new \OC\TagManager($this->tagMapper, $otherUserSession);
- $otherTagger = $otherTagMgr->load('test');
- $this->assertFalse($otherTagger->hasTag($testTag));
-
- \OC_User::setUserId($this->user->getUID());
- // TODO new sharing
- \OC\Share\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
-
- \OC_User::setUserId($otherUserId);
- $otherTagger = $otherTagMgr->load('test', [], true); // Update tags, load shared ones.
- $this->assertTrue($otherTagger->hasTag($testTag));
- $this->assertContains(1, $otherTagger->getIdsForTag($testTag));
- }
}
diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php
index 01f2285670e..42fa06a474d 100644
--- a/tests/lib/Template/CSSResourceLocatorTest.php
+++ b/tests/lib/Template/CSSResourceLocatorTest.php
@@ -37,21 +37,21 @@ use OCP\ILogger;
use OCP\IURLGenerator;
class CSSResourceLocatorTest extends \Test\TestCase {
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ThemingDefaults|\PHPUnit\Framework\MockObject\MockObject */
protected $themingDefaults;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var IconsCacher|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IconsCacher|\PHPUnit\Framework\MockObject\MockObject */
protected $iconsCacher;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
protected function setUp(): void {
@@ -68,7 +68,7 @@ class CSSResourceLocatorTest extends \Test\TestCase {
}
private function cssResourceLocator() {
- /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject $factory */
$factory = $this->createMock(Factory::class);
$factory->method('get')->with('css')->willReturn($this->appData);
$scssCacher = new SCSSCacher(
@@ -107,16 +107,6 @@ class CSSResourceLocatorTest extends \Test\TestCase {
return sha1(uniqid(mt_rand(), true));
}
- public function testConstructor() {
- $locator = $this->cssResourceLocator();
- $this->assertAttributeEquals('theme', 'theme', $locator);
- $this->assertAttributeEquals('core', 'serverroot', $locator);
- $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator);
- $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator);
- $this->assertAttributeEquals('map', 'webroot', $locator);
- $this->assertAttributeEquals([], 'resources', $locator);
- }
-
public function testFindWithAppPathSymlink() {
// First create new apps path, and a symlink to it
$apps_dirname = $this->randomString();
diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php
index 4b5c6a73ef8..24b3c21052f 100644
--- a/tests/lib/Template/IconsCacherTest.php
+++ b/tests/lib/Template/IconsCacherTest.php
@@ -36,13 +36,13 @@ use OCP\ILogger;
use OCP\IURLGenerator;
class IconsCacherTest extends \Test\TestCase {
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
protected function setUp(): void {
@@ -50,7 +50,7 @@ class IconsCacherTest extends \Test\TestCase {
$this->appData = $this->createMock(AppData::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
- /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject $factory */
$factory = $this->createMock(Factory::class);
$factory->method('get')->with('css')->willReturn($this->appData);
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index 0cdea95fd6f..87abff99123 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -36,19 +36,19 @@ use OCP\ILogger;
use OCP\IURLGenerator;
class JSCombinerTest extends \Test\TestCase {
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICache|\PHPUnit\Framework\MockObject\MockObject */
protected $depsCache;
/** @var JSCombiner */
protected $jsCombiner;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
protected function setUp(): void {
diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php
index 0e6b217ec52..cdc3606f020 100644
--- a/tests/lib/Template/JSResourceLocatorTest.php
+++ b/tests/lib/Template/JSResourceLocatorTest.php
@@ -32,15 +32,15 @@ use OCP\ILogger;
use OCP\IURLGenerator;
class JSResourceLocatorTest extends \Test\TestCase {
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
protected function setUp(): void {
@@ -86,17 +86,6 @@ class JSResourceLocatorTest extends \Test\TestCase {
return sha1(uniqid(mt_rand(), true));
}
-
- public function testConstructor() {
- $locator = $this->jsResourceLocator();
- $this->assertAttributeEquals('theme', 'theme', $locator);
- $this->assertAttributeEquals('core', 'serverroot', $locator);
- $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator);
- $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator);
- $this->assertAttributeEquals('map', 'webroot', $locator);
- $this->assertAttributeEquals([], 'resources', $locator);
- }
-
public function testFindWithAppPathSymlink() {
// First create new apps path, and a symlink to it
$apps_dirname = $this->randomString();
diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php
index f0fa8186686..d23d17778d4 100644
--- a/tests/lib/Template/ResourceLocatorTest.php
+++ b/tests/lib/Template/ResourceLocatorTest.php
@@ -12,7 +12,7 @@ use OC\Template\ResourceNotFoundException;
use OCP\ILogger;
class ResourceLocatorTest extends \Test\TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var \PHPUnit\Framework\MockObject\MockObject */
protected $logger;
protected function setUp(): void {
@@ -25,7 +25,7 @@ class ResourceLocatorTest extends \Test\TestCase {
* @param array $core_map
* @param array $party_map
* @param array $appsRoots
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return \PHPUnit\Framework\MockObject\MockObject
*/
public function getResourceLocator($theme, $core_map, $party_map, $appsRoots) {
return $this->getMockForAbstractClass('OC\Template\ResourceLocator',
@@ -33,17 +33,6 @@ class ResourceLocatorTest extends \Test\TestCase {
'', true, true, true, []);
}
- public function testConstructor() {
- $locator = $this->getResourceLocator('theme',
- ['core'=>'map'], ['3rd'=>'party'], ['foo'=>'bar']);
- $this->assertAttributeEquals('theme', 'theme', $locator);
- $this->assertAttributeEquals('core', 'serverroot', $locator);
- $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator);
- $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator);
- $this->assertAttributeEquals('map', 'webroot', $locator);
- $this->assertAttributeEquals([], 'resources', $locator);
- }
-
public function testFind() {
$locator = $this->getResourceLocator('theme',
['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']);
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index 9dfd8d20fea..1a77f789afe 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -40,25 +40,25 @@ use OCP\ILogger;
use OCP\IURLGenerator;
class SCSSCacherTest extends \Test\TestCase {
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $urlGenerator;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ThemingDefaults|\PHPUnit\Framework\MockObject\MockObject */
protected $themingDefaults;
/** @var SCSSCacher */
protected $scssCacher;
- /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICache|\PHPUnit\Framework\MockObject\MockObject */
protected $depsCache;
- /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
- /** @var IconsCacher|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IconsCacher|\PHPUnit\Framework\MockObject\MockObject */
protected $iconsCacher;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
protected function setUp(): void {
@@ -68,7 +68,7 @@ class SCSSCacherTest extends \Test\TestCase {
$this->iconsCacher = $this->createMock(IconsCacher::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
- /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
+ /** @var Factory|\PHPUnit\Framework\MockObject\MockObject $factory */
$factory = $this->createMock(Factory::class);
$factory->method('get')->with('css')->willReturn($this->appData);
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index b28be47875a..13a6fb0cf94 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -51,13 +51,16 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
* @param mixed $newService
* @return bool
*/
- public function overwriteService($name, $newService) {
+ public function overwriteService(string $name, $newService): bool {
if (isset($this->services[$name])) {
return false;
}
$this->services[$name] = \OC::$server->query($name);
- \OC::$server->registerService($name, function () use ($newService) {
+ $container = \OC::$server->getAppContainerForService($name);
+ $container = $container ?? \OC::$server;
+
+ $container->registerService($name, function () use ($newService) {
return $newService;
});
@@ -68,10 +71,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
* @param string $name
* @return bool
*/
- public function restoreService($name) {
+ public function restoreService(string $name): bool {
if (isset($this->services[$name])) {
$oldService = $this->services[$name];
- \OC::$server->registerService($name, function () use ($oldService) {
+
+ $container = \OC::$server->getAppContainerForService($name);
+ $container = $container ?? \OC::$server;
+
+ $container->registerService($name, function () use ($oldService) {
return $oldService;
});
@@ -441,7 +448,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
}
}
- private function IsDatabaseAccessAllowed() {
+ protected function IsDatabaseAccessAllowed() {
// on travis-ci.org we allow database access in any case - otherwise
// this will break all apps right away
if (true == getenv('TRAVIS')) {
@@ -466,13 +473,13 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
require_once __DIR__.'/../../lib/private/legacy/template/functions.php';
$requestToken = 12345;
- /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject $l10n */
+ /** @var Defaults|\PHPUnit\Framework\MockObject\MockObject $l10n */
$theme = $this->getMockBuilder('\OCP\Defaults')
->disableOriginalConstructor()->getMock();
$theme->expects($this->any())
->method('getName')
->willReturn('Nextcloud');
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject $l10n */
+ /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject $l10n */
$l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$l10n
diff --git a/tests/lib/Traits/ClientServiceTrait.php b/tests/lib/Traits/ClientServiceTrait.php
index cab28e76dba..e9e9787d734 100644
--- a/tests/lib/Traits/ClientServiceTrait.php
+++ b/tests/lib/Traits/ClientServiceTrait.php
@@ -26,9 +26,9 @@ use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
trait ClientServiceTrait {
- /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
private $clientService;
- /** @var IClient|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClient|\PHPUnit\Framework\MockObject\MockObject */
private $client;
private $expectedGetRequests = [];
private $expectedPostRequests = [];
@@ -37,7 +37,7 @@ trait ClientServiceTrait {
* Wrapper to be forward compatible to phpunit 5.4+
*
* @param string $originalClassName
- * @return \PHPUnit_Framework_MockObject_MockObject
+ * @return \PHPUnit\Framework\MockObject\MockObject
*/
abstract protected function createMock($originalClassName);
@@ -112,7 +112,7 @@ trait ClientServiceTrait {
}
/**
- * @return IClientService|\PHPUnit_Framework_MockObject_MockObject
+ * @return IClientService|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getClientService() {
return $this->clientService;
diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php
index 0437157e84f..379d33ea71c 100644
--- a/tests/lib/Traits/MountProviderTrait.php
+++ b/tests/lib/Traits/MountProviderTrait.php
@@ -33,6 +33,12 @@ trait MountProviderTrait {
$this->mounts[$userId] = [];
}
$this->mounts[$userId][] = ['storage' => $storage, 'mountPoint' => $mountPoint, 'arguments' => $arguments];
+
+ if ($this->IsDatabaseAccessAllowed()) {
+ $mount = new MountPoint($storage, $mountPoint, $arguments, $this->storageFactory);
+ $storage = $mount->getStorage();
+ $storage->getScanner()->scan('');
+ }
}
protected function registerStorageWrapper($name, $wrapper) {
diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php
index 4d7dce43ee1..1daff9ce1fb 100644
--- a/tests/lib/Updater/ChangesCheckTest.php
+++ b/tests/lib/Updater/ChangesCheckTest.php
@@ -37,16 +37,16 @@ use OCP\ILogger;
use Test\TestCase;
class ChangesCheckTest extends TestCase {
- /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
protected $clientService;
/** @var ChangesCheck */
protected $checker;
- /** @var ChangesMapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ChangesMapper|\PHPUnit\Framework\MockObject\MockObject */
protected $mapper;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
protected function setUp(): void {
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 2f139319bbf..f4216ddb0a3 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -28,9 +28,9 @@ use OCP\IConfig;
use OCP\Util;
class VersionCheckTest extends \Test\TestCase {
- /** @var IConfig| \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig| \PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var VersionCheck | \PHPUnit_Framework_MockObject_MockObject*/
+ /** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject*/
private $updater;
protected function setUp(): void {
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index 3ccf4c8b8c7..1affd6d020a 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -29,15 +29,15 @@ use OCP\IConfig;
use OCP\ILogger;
class UpdaterTest extends TestCase {
- /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger | \PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var Updater */
private $updater;
- /** @var Checker | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var Checker | \PHPUnit\Framework\MockObject\MockObject */
private $checker;
- /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var Installer|\PHPUnit\Framework\MockObject\MockObject */
private $installer;
protected function setUp(): void {
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 03f55ff2244..46508a217d8 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -18,11 +18,11 @@ use OCP\IURLGenerator;
*/
class UrlGeneratorTest extends \Test\TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject|IConfig */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
private $config;
- /** @var \PHPUnit_Framework_MockObject_MockObject|ICacheFactory */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|ICacheFactory */
private $cacheFactory;
- /** @var \PHPUnit_Framework_MockObject_MockObject|IRequest */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|IRequest */
private $request;
/** @var IURLGenerator */
private $urlGenerator;
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 7cc42e81ba2..6037277932d 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -55,7 +55,7 @@ class ManagerTest extends TestCase {
public function testUserExistsSingleBackendExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -71,7 +71,7 @@ class ManagerTest extends TestCase {
public function testUserExistsSingleBackendNotExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -93,7 +93,7 @@ class ManagerTest extends TestCase {
public function testUserExistsTwoBackendsSecondExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend1
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
@@ -102,7 +102,7 @@ class ManagerTest extends TestCase {
->willReturn(false);
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend2
*/
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->once())
@@ -119,7 +119,7 @@ class ManagerTest extends TestCase {
public function testUserExistsTwoBackendsFirstExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend1
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
@@ -128,7 +128,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend2
*/
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->never())
@@ -143,7 +143,7 @@ class ManagerTest extends TestCase {
public function testCheckPassword() {
/**
- * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -170,7 +170,7 @@ class ManagerTest extends TestCase {
public function testCheckPasswordNotSupported() {
/**
- * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->never())
@@ -188,7 +188,7 @@ class ManagerTest extends TestCase {
public function testGetOneBackendExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -206,7 +206,7 @@ class ManagerTest extends TestCase {
public function testGetOneBackendNotExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -222,7 +222,7 @@ class ManagerTest extends TestCase {
public function testGetOneBackendDoNotTranslateLoginNames() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -240,7 +240,7 @@ class ManagerTest extends TestCase {
public function testSearchOneBackend() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -263,7 +263,7 @@ class ManagerTest extends TestCase {
public function testSearchTwoBackendLimitOffset() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend1
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
@@ -274,7 +274,7 @@ class ManagerTest extends TestCase {
->method('loginName2UserName');
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend2
*/
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->once())
@@ -330,7 +330,7 @@ class ManagerTest extends TestCase {
* @dataProvider dataCreateUserInvalid
*/
public function testCreateUserInvalid($uid, $password, $exception) {
- /** @var \Test\Util\User\Dummy|\PHPUnit_Framework_MockObject_MockObject $backend */
+ /** @var \Test\Util\User\Dummy|\PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
->method('implementsActions')
@@ -347,7 +347,7 @@ class ManagerTest extends TestCase {
public function testCreateUserSingleBackendNotExists() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
@@ -377,7 +377,7 @@ class ManagerTest extends TestCase {
$this->expectException(\Exception::class);
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
@@ -400,7 +400,7 @@ class ManagerTest extends TestCase {
public function testCreateUserSingleBackendNotSupported() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
@@ -430,9 +430,9 @@ class ManagerTest extends TestCase {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Could not create user');
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject $config */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->createMock(IConfig::class);
- /** @var \Test\Util\User\Dummy|\PHPUnit_Framework_MockObject_MockObject $backend */
+ /** @var \Test\Util\User\Dummy|\PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend
->expects($this->once())
@@ -449,7 +449,7 @@ class ManagerTest extends TestCase {
$this->expectException(\Exception::class);
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend1
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->any())
@@ -465,7 +465,7 @@ class ManagerTest extends TestCase {
->willReturn(false);
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend2
*/
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->any())
@@ -497,7 +497,7 @@ class ManagerTest extends TestCase {
public function testCountUsersOneBackend() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -526,7 +526,7 @@ class ManagerTest extends TestCase {
public function testCountUsersTwoBackends() {
/**
- * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index 4e527addc6e..3a9c7766e3c 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -41,7 +41,7 @@ class UserTest extends TestCase {
public function testDisplayName() {
/**
- * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Backend::class);
$backend->expects($this->once())
@@ -63,7 +63,7 @@ class UserTest extends TestCase {
*/
public function testDisplayNameEmpty() {
/**
- * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Backend::class);
$backend->expects($this->once())
@@ -82,7 +82,7 @@ class UserTest extends TestCase {
public function testDisplayNameNotSupported() {
/**
- * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Backend::class);
$backend->expects($this->never())
@@ -99,7 +99,7 @@ class UserTest extends TestCase {
public function testSetPassword() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -122,7 +122,7 @@ class UserTest extends TestCase {
public function testSetPasswordNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->never())
@@ -138,7 +138,7 @@ class UserTest extends TestCase {
public function testChangeAvatarSupportedYes() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(AvatarUserDummy::class);
$backend->expects($this->once())
@@ -162,7 +162,7 @@ class UserTest extends TestCase {
public function testChangeAvatarSupportedNo() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(AvatarUserDummy::class);
$backend->expects($this->once())
@@ -186,7 +186,7 @@ class UserTest extends TestCase {
public function testChangeAvatarNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(AvatarUserDummy::class);
$backend->expects($this->never())
@@ -202,7 +202,7 @@ class UserTest extends TestCase {
public function testDelete() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -215,7 +215,7 @@ class UserTest extends TestCase {
public function testDeleteWithDifferentHome() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -247,7 +247,7 @@ class UserTest extends TestCase {
public function testGetHome() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -278,7 +278,7 @@ class UserTest extends TestCase {
public function testGetHomeNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->never())
@@ -305,7 +305,7 @@ class UserTest extends TestCase {
public function testCanChangePassword() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -325,7 +325,7 @@ class UserTest extends TestCase {
public function testCanChangePasswordNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -339,7 +339,7 @@ class UserTest extends TestCase {
public function testCanChangeDisplayName() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -359,7 +359,7 @@ class UserTest extends TestCase {
public function testCanChangeDisplayNameNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -373,7 +373,7 @@ class UserTest extends TestCase {
public function testSetDisplayNameSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Database::class);
@@ -402,7 +402,7 @@ class UserTest extends TestCase {
*/
public function testSetDisplayNameEmpty() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Database::class);
@@ -423,7 +423,7 @@ class UserTest extends TestCase {
public function testSetDisplayNameNotSupported() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\OC\User\Database::class);
@@ -444,7 +444,7 @@ class UserTest extends TestCase {
$test = $this;
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -497,7 +497,7 @@ class UserTest extends TestCase {
$test = $this;
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -574,7 +574,7 @@ class UserTest extends TestCase {
public function testGetCloudId() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$urlGenerator = $this->getMockBuilder('\OC\URLGenerator')
@@ -591,7 +591,7 @@ class UserTest extends TestCase {
public function testSetEMailAddressEmpty() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -627,7 +627,7 @@ class UserTest extends TestCase {
public function testSetEMailAddress() {
/**
- * @var UserInterface | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var UserInterface | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -664,11 +664,11 @@ class UserTest extends TestCase {
public function testSetEMailAddressNoChange() {
/**
- * @var UserInterface | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var UserInterface | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
- /** @var PublicEmitter|\PHPUnit_Framework_MockObject_MockObject $emitter */
+ /** @var PublicEmitter|\PHPUnit\Framework\MockObject\MockObject $emitter */
$emitter = $this->createMock(PublicEmitter::class);
$emitter->expects($this->never())
->method('emit');
@@ -686,7 +686,7 @@ class UserTest extends TestCase {
public function testSetQuota() {
/**
- * @var UserInterface | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var UserInterface | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -723,11 +723,11 @@ class UserTest extends TestCase {
public function testSetQuotaAddressNoChange() {
/**
- * @var UserInterface | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var UserInterface | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
- /** @var PublicEmitter|\PHPUnit_Framework_MockObject_MockObject $emitter */
+ /** @var PublicEmitter|\PHPUnit\Framework\MockObject\MockObject $emitter */
$emitter = $this->createMock(PublicEmitter::class);
$emitter->expects($this->never())
->method('emit');
@@ -745,7 +745,7 @@ class UserTest extends TestCase {
public function testGetLastLogin() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -765,7 +765,7 @@ class UserTest extends TestCase {
public function testSetEnabled() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -785,7 +785,7 @@ class UserTest extends TestCase {
public function testSetDisabled() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -825,7 +825,7 @@ class UserTest extends TestCase {
public function testSetDisabledAlreadyDisabled() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
@@ -855,7 +855,7 @@ class UserTest extends TestCase {
public function testGetEMailAddress() {
/**
- * @var Backend | \PHPUnit_Framework_MockObject_MockObject $backend
+ * @var Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
$backend = $this->createMock(\Test\Util\User\Dummy::class);
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index b5a05535009..9ddb1f8e45f 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -18,7 +18,7 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* @param array $systemOptions
- * @return \OC\SystemConfig | \PHPUnit_Framework_MockObject_MockObject
+ * @return \OC\SystemConfig | \PHPUnit\Framework\MockObject\MockObject
*/
protected function getConfig($systemOptions) {
$systemOptions['datadirectory'] = $this->datadir;