From 2ee65f177e4f7e09ad2287f14d564e7068d322fb Mon Sep 17 00:00:00 2001
From: Christoph Wurst
Date: Wed, 25 Mar 2020 22:21:27 +0100
Subject: [PATCH] Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst
---
.../tests/Unit/Notification/ListenerTest.php | 36 +-
.../tests/Unit/Notification/NotifierTest.php | 4 +-
.../tests/unit/AppInfo/PluginManagerTest.php | 8 +-
.../CleanupInvitationTokenJobTest.php | 20 +-
...erateBirthdayCalendarBackgroundJobTest.php | 14 +-
.../BackgroundJob/RefreshWebcalJobTest.php | 2 +-
...egisterRegenerateBirthdayCalendarsTest.php | 10 +-
...alendarResourcesRoomsBackgroundJobTest.php | 88 +--
.../BirthdayCalendar/EnablePluginTest.php | 30 +-
.../CalDAV/CachedSubscriptionObjectTest.php | 4 +-
.../unit/CalDAV/CachedSubscriptionTest.php | 22 +-
.../tests/unit/CalDAV/CalDavBackendTest.php | 4 +-
.../tests/unit/CalDAV/CalendarHomeTest.php | 6 +-
.../tests/unit/CalDAV/CalendarImplTest.php | 18 +-
.../tests/unit/CalDAV/CalendarManagerTest.php | 12 +-
apps/dav/tests/unit/CalDAV/CalendarTest.php | 8 +-
apps/dav/tests/unit/CalDAV/OutboxTest.php | 4 +-
.../EmailProviderTest.php | 16 +-
.../AbstractPrincipalBackendTest.php | 40 +-
.../unit/CalDAV/Schedule/IMipPluginTest.php | 14 +-
.../unit/CalDAV/Search/SearchPluginTest.php | 12 +-
.../unit/CalDAV/WebcalCaching/PluginTest.php | 8 +-
.../RefreshWebcalServiceTest.php | 22 +-
.../unit/CardDAV/BirthdayServiceTest.php | 20 +-
.../tests/unit/Comments/CommentsNodeTest.php | 96 +--
.../unit/Comments/CommentsPluginTest.php | 118 +--
.../unit/Comments/EntityCollectionTest.php | 12 +-
.../unit/Comments/RootCollectionTest.php | 4 +-
.../tests/unit/Connector/Sabre/AuthTest.php | 116 +--
.../Sabre/BlockLegacyClientPluginTest.php | 10 +-
.../Sabre/CommentsPropertiesPluginTest.php | 10 +-
.../Sabre/CustomPropertiesBackendTest.php | 6 +-
.../unit/Connector/Sabre/DirectoryTest.php | 56 +-
.../Connector/Sabre/FakeLockerPluginTest.php | 2 +-
.../tests/unit/Connector/Sabre/FileTest.php | 46 +-
.../unit/Connector/Sabre/FilesPluginTest.php | 36 +-
.../Connector/Sabre/FilesReportPluginTest.php | 120 +--
.../Connector/Sabre/MaintenancePluginTest.php | 2 +-
.../tests/unit/Connector/Sabre/NodeTest.php | 8 +-
.../unit/Connector/Sabre/ObjectTreeTest.php | 20 +-
.../unit/Connector/Sabre/PrincipalTest.php | 204 ++---
.../unit/Connector/Sabre/QuotaPluginTest.php | 10 +-
.../RequestTest/PartFileInRootUploadTest.php | 4 +-
.../unit/Connector/Sabre/SharesPluginTest.php | 26 +-
.../unit/Connector/Sabre/TagsPluginTest.php | 34 +-
.../BirthdayCalendarControllerTest.php | 10 +-
.../InvitationResponseControllerTest.php | 50 +-
.../unit/DAV/CustomPropertiesBackendTest.php | 14 +-
.../dav/tests/unit/DAV/GroupPrincipalTest.php | 40 +-
apps/dav/tests/unit/DAV/HookManagerTest.php | 4 +-
.../unit/Files/FileSearchBackendTest.php | 28 +-
.../Files/Sharing/FilesDropPluginTest.php | 8 +-
.../RefreshWebcalJobRegistrarTest.php | 28 +-
.../SystemTag/SystemTagMappingNodeTest.php | 12 +-
.../unit/SystemTag/SystemTagNodeTest.php | 22 +-
.../unit/SystemTag/SystemTagPluginTest.php | 76 +-
.../SystemTagsByIdCollectionTest.php | 22 +-
.../SystemTagsObjectMappingCollectionTest.php | 46 +-
.../SystemTagsObjectTypeCollectionTest.php | 14 +-
.../tests/unit/Upload/ChunkingPluginTest.php | 12 +-
.../Controller/RecoveryControllerTest.php | 8 +-
.../Controller/SettingsControllerTest.php | 4 +-
.../tests/Controller/StatusControllerTest.php | 4 +-
.../tests/Crypto/EncryptionTest.php | 4 +-
apps/encryption/tests/Hooks/UserHooksTest.php | 2 +-
apps/encryption/tests/RecoveryTest.php | 6 +-
apps/encryption/tests/SessionTest.php | 6 +-
apps/encryption/tests/UtilTest.php | 6 +-
.../tests/FederatedShareProviderTest.php | 4 +-
.../tests/BackgroundJob/ScanFilesTest.php | 24 +-
.../tests/Controller/ApiControllerTest.php | 4 +-
.../tests/Controller/ViewControllerTest.php | 62 +-
apps/files/tests/Service/TagServiceTest.php | 2 +-
.../tests/Auth/Password/GlobalAuth.php | 20 +-
.../tests/Command/ApplicableTest.php | 4 +-
.../tests/Command/CommandTest.php | 4 +-
.../Controller/StoragesControllerTest.php | 20 +-
.../Controller/UserStoragesControllerTest.php | 2 +-
.../tests/FrontendDefinitionTraitTest.php | 4 +-
.../tests/PersonalMountTest.php | 2 +-
.../tests/Service/BackendServiceTest.php | 18 +-
.../tests/Service/StoragesServiceTest.php | 20 +-
.../Service/UserGlobalStoragesServiceTest.php | 10 +-
.../tests/Service/UserStoragesServiceTest.php | 2 +-
apps/files_sharing/tests/ApiTest.php | 4 +-
apps/files_sharing/tests/CapabilitiesTest.php | 2 +-
.../Controller/ShareAPIControllerTest.php | 144 ++--
.../tests/Controller/ShareControllerTest.php | 12 +-
.../Controller/ShareesAPIControllerTest.php | 4 +-
.../tests/External/CacheTest.php | 2 +-
.../Middleware/OCSShareAPIMiddlewareTest.php | 2 +-
.../Middleware/SharingCheckMiddlewareTest.php | 18 +-
.../files_sharing/tests/MountProviderTest.php | 42 +-
apps/files_trashbin/tests/StorageTest.php | 8 +-
apps/files_trashbin/tests/TrashbinTest.php | 4 +-
apps/files_versions/tests/VersioningTest.php | 8 +-
.../Controller/OauthApiControllerTest.php | 12 +-
.../Controller/SettingsControllerTest.php | 4 +-
.../tests/Controller/GroupsControllerTest.php | 4 +-
.../tests/Controller/UsersControllerTest.php | 718 +++++++++---------
.../tests/Activity/SecurityFilterTest.php | 6 +-
.../tests/Activity/SecuritySettingTest.php | 2 +-
.../Controller/AppSettingsControllerTest.php | 6 +-
.../Controller/CertificateControllerTest.php | 26 +-
.../Controller/CheckSetupControllerTest.php | 120 +--
.../Controller/MailSettingsControllerTest.php | 8 +-
.../tests/Controller/UsersControllerTest.php | 4 +-
.../tests/Mailer/NewUserMailHelperTest.php | 10 +-
.../Middleware/SubadminMiddlewareTest.php | 8 +-
.../tests/ShareByMailProviderTest.php | 4 +-
.../Controller/ThemingControllerTest.php | 40 +-
.../tests/Db/BackupCodeMapperTest.php | 4 +-
.../tests/Service/BackupCodeStorageTest.php | 2 +-
.../BackgroundJob/CheckBackupCodeTest.php | 4 +-
.../Controller/SettingsControllerTest.php | 6 +-
.../Unit/Listener/ActivityPublisherTest.php | 12 +-
.../Unit/Provider/BackupCodesProviderTest.php | 8 +-
.../Unit/Service/BackupCodeStorageTest.php | 22 +-
apps/user_ldap/tests/AccessTest.php | 28 +-
apps/user_ldap/tests/ConnectionTest.php | 44 +-
apps/user_ldap/tests/Group_LDAPTest.php | 116 +--
apps/user_ldap/tests/HelperTest.php | 8 +-
apps/user_ldap/tests/Jobs/CleanUpTest.php | 10 +-
apps/user_ldap/tests/User/ManagerTest.php | 18 +-
apps/user_ldap/tests/User/UserTest.php | 168 ++--
apps/user_ldap/tests/User_LDAPTest.php | 140 ++--
apps/user_ldap/tests/WizardTest.php | 120 +--
apps/workflowengine/tests/ManagerTest.php | 4 +-
.../Command/Config/System/SetConfigTest.php | 8 +-
tests/Core/Command/Log/FileTest.php | 16 +-
tests/Core/Command/Log/ManageTest.php | 12 +-
.../Maintenance/Mimetype/UpdateDBTest.php | 16 +-
.../Core/Controller/AvatarControllerTest.php | 2 +-
.../ChangePasswordControllerTest.php | 2 +-
.../ClientFlowLoginControllerTest.php | 4 +-
.../ClientFlowLoginV2ControllerTest.php | 28 +-
tests/Core/Controller/CssControllerTest.php | 4 +-
tests/Core/Controller/JsControllerTest.php | 4 +-
tests/Core/Controller/LoginControllerTest.php | 24 +-
tests/Core/Controller/LostControllerTest.php | 56 +-
.../TwoFactorChallengeControllerTest.php | 64 +-
tests/Core/Controller/UserControllerTest.php | 4 +-
.../Middleware/TwoFactorMiddlewareTest.php | 40 +-
tests/lib/APITest.php | 2 +-
tests/lib/AllConfigTest.php | 6 +-
tests/lib/App/AppManagerTest.php | 32 +-
tests/lib/App/AppStore/Bundles/BundleBase.php | 4 +-
.../App/AppStore/Fetcher/AppFetcherTest.php | 8 +-
.../AppStore/Fetcher/CategoryFetcherTest.php | 8 +-
tests/lib/App/DependencyAnalyzerTest.php | 22 +-
tests/lib/AppFramework/AppTest.php | 14 +-
.../AuthPublicShareControllerTest.php | 4 +-
.../Controller/ControllerTest.php | 2 +-
tests/lib/AppFramework/Db/MapperTest.php | 4 +-
.../lib/AppFramework/Db/MapperTestUtility.php | 8 +-
.../lib/AppFramework/Http/DispatcherTest.php | 30 +-
tests/lib/AppFramework/Http/RequestTest.php | 104 +--
.../AppFramework/Http/StreamResponseTest.php | 12 +-
.../Middleware/MiddlewareDispatcherTest.php | 4 +-
.../Security/CORSMiddlewareTest.php | 6 +-
.../Security/SecurityMiddlewareTest.php | 26 +-
.../lib/AppFramework/Routing/RoutingTest.php | 22 +-
tests/lib/AppTest.php | 8 +-
.../Token/DefaultTokenProviderTest.php | 22 +-
.../Token/PublicKeyTokenProviderTest.php | 10 +-
.../TwoFactorAuth/ManagerTest.php | 20 +-
.../TwoFactorAuth/ProviderLoaderTest.php | 4 +-
tests/lib/Avatar/UserAvatarTest.php | 34 +-
tests/lib/BackgroundJob/JobListTest.php | 2 +-
tests/lib/Cache/FileCacheTest.php | 8 +-
tests/lib/Calendar/ManagerTest.php | 24 +-
tests/lib/Calendar/Resource/ManagerTest.php | 24 +-
tests/lib/Calendar/Room/ManagerTest.php | 24 +-
tests/lib/Command/Integrity/SignAppTest.php | 48 +-
tests/lib/Command/Integrity/SignCoreTest.php | 36 +-
tests/lib/Comments/ManagerTest.php | 10 +-
.../ContactsMenu/ActionProviderStoreTest.php | 8 +-
tests/lib/ContactsManagerTest.php | 4 +-
tests/lib/DB/MDB2SchemaReaderTest.php | 4 +-
tests/lib/Encryption/Keys/StorageTest.php | 8 +-
tests/lib/Encryption/UtilTest.php | 2 +-
tests/lib/FileChunkingTest.php | 4 +-
tests/lib/Files/Cache/CacheTest.php | 2 +-
tests/lib/Files/Config/UserMountCacheTest.php | 16 +-
tests/lib/Files/Mount/MountPointTest.php | 4 +-
tests/lib/Files/Node/FileTest.php | 32 +-
tests/lib/Files/Node/FolderTest.php | 170 ++---
tests/lib/Files/Node/NodeTest.php | 116 +--
tests/lib/Files/Node/RootTest.php | 4 +-
tests/lib/Files/Storage/Wrapper/QuotaTest.php | 10 +-
tests/lib/Files/Stream/EncryptionTest.php | 4 +-
tests/lib/Files/Type/DetectionTest.php | 8 +-
tests/lib/Files/Utils/ScannerTest.php | 8 +-
tests/lib/Files/ViewTest.php | 56 +-
tests/lib/Group/GroupTest.php | 68 +-
tests/lib/Group/ManagerTest.php | 166 ++--
tests/lib/Group/MetaDataTest.php | 8 +-
tests/lib/HelperStorageTest.php | 2 +-
tests/lib/IntegrityCheck/CheckerTest.php | 188 ++---
tests/lib/L10N/FactoryTest.php | 12 +-
tests/lib/LegacyHelperTest.php | 24 +-
tests/lib/Lock/DBLockingProviderTest.php | 4 +-
tests/lib/Mail/MailerTest.php | 24 +-
tests/lib/Mail/MessageTest.php | 12 +-
tests/lib/Memcache/CasTraitTest.php | 16 +-
tests/lib/OCS/ProviderTest.php | 26 +-
tests/lib/Preview/GeneratorTest.php | 16 +-
tests/lib/Repair/RepairInvalidSharesTest.php | 2 +-
tests/lib/Repair/RepairMimeTypesTest.php | 2 +-
tests/lib/RepairStepTest.php | 2 +-
.../lib/Security/Bruteforce/ThrottlerTest.php | 4 +-
tests/lib/Security/CredentialsManagerTest.php | 2 +-
.../lib/Security/TrustedDomainHelperTest.php | 6 +-
tests/lib/Settings/ManagerTest.php | 4 +-
tests/lib/SetupTest.php | 28 +-
.../lib/Share20/DefaultShareProviderTest.php | 174 ++---
tests/lib/Share20/LegacyHooksTest.php | 4 +-
tests/lib/Share20/ManagerTest.php | 200 ++---
tests/lib/SystemTag/SystemTagManagerTest.php | 10 +-
.../SystemTag/SystemTagObjectMapperTest.php | 4 +-
tests/lib/TagsTest.php | 4 +-
tests/lib/Template/JSCombinerTest.php | 32 +-
tests/lib/Template/SCSSCacherTest.php | 32 +-
tests/lib/TestCase.php | 4 +-
tests/lib/Updater/VersionCheckTest.php | 44 +-
tests/lib/User/ManagerTest.php | 74 +-
tests/lib/User/SessionTest.php | 160 ++--
tests/lib/User/UserTest.php | 78 +-
tests/lib/UtilCheckServerTest.php | 4 +-
tests/lib/UtilTest.php | 10 +-
230 files changed, 3356 insertions(+), 3356 deletions(-)
diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php
index ee4f296ed0a99..1972244a38ece 100644
--- a/apps/comments/tests/Unit/Notification/ListenerTest.php
+++ b/apps/comments/tests/Unit/Notification/ListenerTest.php
@@ -78,10 +78,10 @@ public function testEvaluate($eventType, $notificationMethod) {
$comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$comment->expects($this->any())
->method('getCreationDateTime')
- ->will($this->returnValue(new \DateTime()));
+ ->willReturn(new \DateTime());
$comment->expects($this->once())
->method('getMentions')
->willReturn([
@@ -102,22 +102,22 @@ public function testEvaluate($eventType, $notificationMethod) {
->getMock();
$event->expects($this->once())
->method('getComment')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$event->expects(($this->any()))
->method(('getEvent'))
- ->will($this->returnValue($eventType));
+ ->willReturn($eventType);
/** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->exactly(6))
->method('setUser');
$this->notificationManager->expects($this->once())
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(6))
->method($notificationMethod)
->with($this->isInstanceOf('\OCP\Notification\INotification'));
@@ -132,7 +132,7 @@ public function testEvaluate($eventType, $notificationMethod) {
['23452-4333-54353-2342'],
['yolo']
)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->listener->evaluate($event);
}
@@ -146,10 +146,10 @@ public function testEvaluateNoMentions($eventType) {
$comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$comment->expects($this->any())
->method('getCreationDateTime')
- ->will($this->returnValue(new \DateTime()));
+ ->willReturn(new \DateTime());
$comment->expects($this->once())
->method('getMentions')
->willReturn([]);
@@ -160,10 +160,10 @@ public function testEvaluateNoMentions($eventType) {
->getMock();
$event->expects($this->once())
->method('getComment')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$event->expects(($this->any()))
->method(('getEvent'))
- ->will($this->returnValue($eventType));
+ ->willReturn($eventType);
$this->notificationManager->expects($this->never())
->method('createNotification');
@@ -183,10 +183,10 @@ public function testEvaluateUserDoesNotExist() {
$comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$comment->expects($this->any())
->method('getCreationDateTime')
- ->will($this->returnValue(new \DateTime()));
+ ->willReturn(new \DateTime());
$comment->expects($this->once())
->method('getMentions')
->willReturn([[ 'type' => 'user', 'id' => 'foobar']]);
@@ -200,22 +200,22 @@ public function testEvaluateUserDoesNotExist() {
->getMock();
$event->expects($this->once())
->method('getComment')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$event->expects(($this->any()))
->method(('getEvent'))
- ->will($this->returnValue(CommentsEvent::EVENT_ADD));
+ ->willReturn(CommentsEvent::EVENT_ADD);
/** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
$notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->never())
->method('setUser');
$this->notificationManager->expects($this->once())
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->never())
->method('notify');
@@ -224,7 +224,7 @@ public function testEvaluateUserDoesNotExist() {
->withConsecutive(
['foobar']
)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->listener->evaluate($event);
}
diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php
index 34de6620897fd..2924c10c8560f 100644
--- a/apps/comments/tests/Unit/Notification/NotifierTest.php
+++ b/apps/comments/tests/Unit/Notification/NotifierTest.php
@@ -84,9 +84,9 @@ protected function setUp(): void {
$this->l = $this->createMock(IL10N::class);
$this->l->expects($this->any())
->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->notification = $this->createMock(INotification::class);
$this->comment = $this->createMock(IComment::class);
diff --git a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
index 0d181f914a155..2fbf127134155 100644
--- a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
+++ b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
@@ -84,10 +84,10 @@ public function test() {
];
$appManager->method('getAppInfo')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['adavapp', false, null, $appInfo1],
['adavapp2', false, null, $appInfo2],
- ]));
+ ]);
$pluginManager = new PluginManager($server, $appManager);
@@ -96,7 +96,7 @@ public function test() {
$calendarPlugin3 = $this->createMock(ICalendarProvider::class);
$server->method('query')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['\OCA\DAV\ADavApp\PluginOne', true, 'dummyplugin1'],
['\OCA\DAV\ADavApp\PluginTwo', true, 'dummyplugin2'],
['\OCA\DAV\ADavApp\CalendarPluginOne', true, $calendarPlugin1],
@@ -106,7 +106,7 @@ public function test() {
['\OCA\DAV\ADavApp2\PluginOne', true, 'dummy2plugin1'],
['\OCA\DAV\ADavApp2\CalendarPluginOne', true, $calendarPlugin3],
['\OCA\DAV\ADavApp2\CollectionOne', true, 'dummy2collection1'],
- ]));
+ ]);
$expectedPlugins = [
'dummyplugin1',
diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
index 37bc5195e57ec..9134186390f7c 100644
--- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
@@ -59,7 +59,7 @@ public function testRun() {
$this->timeFactory->expects($this->once())
->method('getTime')
->with()
- ->will($this->returnValue(1337));
+ ->willReturn(1337);
$queryBuilder = $this->createMock(IQueryBuilder::class);
$expr = $this->createMock(\OCP\DB\QueryBuilder\IExpressionBuilder::class);
@@ -68,36 +68,36 @@ public function testRun() {
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')
->with()
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->method('expr')
- ->will($this->returnValue($expr));
+ ->willReturn($expr);
$queryBuilder->method('createNamedParameter')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[1337, \PDO::PARAM_STR, null, 'namedParameter1337']
- ]));
+ ]);
$expr->expects($this->once())
->method('lt')
->with('expiration', 'namedParameter1337')
- ->will($this->returnValue('LT STATEMENT'));
+ ->willReturn('LT STATEMENT');
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')
->with()
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(0))
->method('delete')
->with('calendar_invitations')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(3))
->method('where')
->with('LT STATEMENT')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(4))
->method('execute')
->with()
- ->will($this->returnValue($stmt));
+ ->willReturn($stmt);
$this->backgroundJob->run([]);
}
diff --git a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
index b053f9a3996df..4529383c37cf1 100644
--- a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
@@ -54,12 +54,12 @@ public function testRun() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user123', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->birthdayService->expects($this->never())
->method('resetForUser')
@@ -76,12 +76,12 @@ public function testRunAndReset() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user123', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->birthdayService->expects($this->once())
->method('resetForUser')
@@ -98,7 +98,7 @@ public function testRunGloballyDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->config->expects($this->never())
->method('getUserValue');
@@ -113,12 +113,12 @@ public function testRunUserDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user123', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->birthdayService->expects($this->never())
->method('syncUser');
diff --git a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
index 95aebd449c70c..fd0301c77822e 100644
--- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
@@ -96,7 +96,7 @@ public function testRun(int $lastRun, int $time, bool $process) {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'calendarSubscriptionRefreshRate', 'P1W')
- ->will($this->returnValue('P1W'));
+ ->willReturn('P1W');
$this->timeFactory->expects($this->once())
->method('getTime')
diff --git a/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php b/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php
index 7251fffc41fd8..19b3cd64d7d39 100644
--- a/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php
@@ -65,18 +65,18 @@ protected function setUp(): void {
public function testRun() {
$this->userManager->expects($this->once())
->method('callForSeenUsers')
- ->will($this->returnCallback(function($closure) {
+ ->willReturnCallback(function($closure) {
$user1 = $this->createMock(IUser::class);
- $user1->method('getUID')->will($this->returnValue('uid1'));
+ $user1->method('getUID')->willReturn('uid1');
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('uid2'));
+ $user2->method('getUID')->willReturn('uid2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('uid3'));
+ $user3->method('getUID')->willReturn('uid3');
$closure($user1);
$closure($user2);
$closure($user3);
- }));
+ });
$this->jobList->expects($this->at(0))
->method('add')
diff --git a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php
index bc515383053a2..bd232ff852e6e 100644
--- a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php
@@ -112,7 +112,7 @@ public function testRun() {
$res9 = $this->createMock(IResource::class);
$backend2->method('getBackendIdentifier')
- ->will($this->returnValue('backend2'));
+ ->willReturn('backend2');
$backend2->method('listAllResources')
->will($this->throwException(new BackendTemporarilyUnavailableException()));
$backend2->method('getResource')
@@ -120,32 +120,32 @@ public function testRun() {
$backend2->method('getAllResources')
->will($this->throwException(new BackendTemporarilyUnavailableException()));
$backend3->method('getBackendIdentifier')
- ->will($this->returnValue('backend3'));
+ ->willReturn('backend3');
$backend3->method('listAllResources')
- ->will($this->returnValue(['res6', 'res7']));
+ ->willReturn(['res6', 'res7']);
$backend3->method('getResource')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['res6', $res6],
['res7', $res7],
- ]));
+ ]);
$backend4->method('getBackendIdentifier')
- ->will($this->returnValue('backend4'));
+ ->willReturn('backend4');
$backend4->method('listAllResources')
- ->will($this->returnValue(['res8', 'res9']));
+ ->willReturn(['res8', 'res9']);
$backend4->method('getResource')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['res8', $res8],
['res9', $res9],
- ]));
+ ]);
- $res6->method('getId')->will($this->returnValue('res6'));
- $res6->method('getDisplayName')->will($this->returnValue('Pointer123'));
- $res6->method('getGroupRestrictions')->will($this->returnValue(['foo', 'biz']));
- $res6->method('getEMail')->will($this->returnValue('res6@foo.bar'));
- $res6->method('getBackend')->will($this->returnValue($backend3));
+ $res6->method('getId')->willReturn('res6');
+ $res6->method('getDisplayName')->willReturn('Pointer123');
+ $res6->method('getGroupRestrictions')->willReturn(['foo', 'biz']);
+ $res6->method('getEMail')->willReturn('res6@foo.bar');
+ $res6->method('getBackend')->willReturn($backend3);
- $res6->method('getAllAvailableMetadataKeys')->will($this->returnValue(['meta99', 'meta123']));
- $res6->method('getMetadataForKey')->will($this->returnCallback(function($key) {
+ $res6->method('getAllAvailableMetadataKeys')->willReturn(['meta99', 'meta123']);
+ $res6->method('getMetadataForKey')->willReturnCallback(function($key) {
switch($key) {
case 'meta99':
return 'value99-new';
@@ -156,15 +156,15 @@ public function testRun() {
default:
return null;
}
- }));
-
- $res7->method('getId')->will($this->returnValue('res7'));
- $res7->method('getDisplayName')->will($this->returnValue('Resource4'));
- $res7->method('getGroupRestrictions')->will($this->returnValue(['biz']));
- $res7->method('getEMail')->will($this->returnValue('res7@foo.bar'));
- $res7->method('getBackend')->will($this->returnValue($backend3));
- $res7->method('getAllAvailableMetadataKeys')->will($this->returnValue(['meta1']));
- $res7->method('getMetadataForKey')->will($this->returnCallback(function($key) {
+ });
+
+ $res7->method('getId')->willReturn('res7');
+ $res7->method('getDisplayName')->willReturn('Resource4');
+ $res7->method('getGroupRestrictions')->willReturn(['biz']);
+ $res7->method('getEMail')->willReturn('res7@foo.bar');
+ $res7->method('getBackend')->willReturn($backend3);
+ $res7->method('getAllAvailableMetadataKeys')->willReturn(['meta1']);
+ $res7->method('getMetadataForKey')->willReturnCallback(function($key) {
switch($key) {
case 'meta1':
return 'value1';
@@ -172,15 +172,15 @@ public function testRun() {
default:
return null;
}
- }));
-
- $res8->method('getId')->will($this->returnValue('res8'));
- $res8->method('getDisplayName')->will($this->returnValue('Beamer'));
- $res8->method('getGroupRestrictions')->will($this->returnValue([]));
- $res8->method('getEMail')->will($this->returnValue('res8@foo.bar'));
- $res8->method('getBackend')->will($this->returnValue($backend4));
- $res8->method('getAllAvailableMetadataKeys')->will($this->returnValue(['meta2']));
- $res8->method('getMetadataForKey')->will($this->returnCallback(function($key) {
+ });
+
+ $res8->method('getId')->willReturn('res8');
+ $res8->method('getDisplayName')->willReturn('Beamer');
+ $res8->method('getGroupRestrictions')->willReturn([]);
+ $res8->method('getEMail')->willReturn('res8@foo.bar');
+ $res8->method('getBackend')->willReturn($backend4);
+ $res8->method('getAllAvailableMetadataKeys')->willReturn(['meta2']);
+ $res8->method('getMetadataForKey')->willReturnCallback(function($key) {
switch($key) {
case 'meta2':
return 'value2';
@@ -188,26 +188,26 @@ public function testRun() {
default:
return null;
}
- }));
+ });
- $res9->method('getId')->will($this->returnValue('res9'));
- $res9->method('getDisplayName')->will($this->returnValue('Beamer2'));
- $res9->method('getGroupRestrictions')->will($this->returnValue([]));
- $res9->method('getEMail')->will($this->returnValue('res9@foo.bar'));
- $res9->method('getBackend')->will($this->returnValue($backend4));
+ $res9->method('getId')->willReturn('res9');
+ $res9->method('getDisplayName')->willReturn('Beamer2');
+ $res9->method('getGroupRestrictions')->willReturn([]);
+ $res9->method('getEMail')->willReturn('res9@foo.bar');
+ $res9->method('getBackend')->willReturn($backend4);
$this->resourceManager
->method('getBackends')
- ->will($this->returnValue([
+ ->willReturn([
$backend2, $backend3, $backend4
- ]));
+ ]);
$this->resourceManager
->method('getBackend')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['backend2', $backend2],
['backend3', $backend3],
['backend4', $backend4],
- ]));
+ ]);
$this->backgroundJob->run([]);
diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
index ca58625ec58ac..f687555a7e4d8 100644
--- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
@@ -92,11 +92,11 @@ public function testHttpPostNoCalendarHome() {
$this->server->expects($this->once())
->method('getRequestUri')
- ->will($this->returnValue('/bar/foo'));
+ ->willReturn('/bar/foo');
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/bar/foo')
- ->will($this->returnValue($calendar));
+ ->willReturn($calendar);
$this->config->expects($this->never())
->method('setUserValue');
@@ -112,25 +112,25 @@ public function testHttpPostWrongRequest() {
$this->server->expects($this->once())
->method('getRequestUri')
- ->will($this->returnValue('/bar/foo'));
+ ->willReturn('/bar/foo');
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/bar/foo')
- ->will($this->returnValue($calendarHome));
+ ->willReturn($calendarHome);
$this->request->expects($this->at(0))
->method('getBodyAsString')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->request->expects($this->at(1))
->method('getUrl')
- ->will($this->returnValue('url_abc'));
+ ->willReturn('url_abc');
$this->server->xml->expects($this->once())
->method('parse')
- ->will($this->returnCallback(function($requestBody, $url, &$documentType) {
+ ->willReturnCallback(function($requestBody, $url, &$documentType) {
$documentType = '{http://nextcloud.com/ns}disable-birthday-calendar';
- }));
+ });
$this->config->expects($this->never())
->method('setUserValue');
@@ -146,29 +146,29 @@ public function testHttpPost() {
$this->server->expects($this->once())
->method('getRequestUri')
- ->will($this->returnValue('/bar/foo'));
+ ->willReturn('/bar/foo');
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/bar/foo')
- ->will($this->returnValue($calendarHome));
+ ->willReturn($calendarHome);
$calendarHome->expects($this->once())
->method('getOwner')
- ->will($this->returnValue('principals/users/BlaBlub'));
+ ->willReturn('principals/users/BlaBlub');
$this->request->expects($this->at(0))
->method('getBodyAsString')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->request->expects($this->at(1))
->method('getUrl')
- ->will($this->returnValue('url_abc'));
+ ->willReturn('url_abc');
$this->server->xml->expects($this->once())
->method('parse')
- ->will($this->returnCallback(function($requestBody, $url, &$documentType) {
+ ->willReturnCallback(function($requestBody, $url, &$documentType) {
$documentType = '{http://nextcloud.com/ns}enable-birthday-calendar';
- }));
+ });
$this->config->expects($this->once())
->method('setUserValue')
diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
index f0357f203e216..28921e81ebf9b 100644
--- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
+++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
@@ -46,9 +46,9 @@ public function testGet() {
$backend->expects($this->once())
->method('getCalendarObject')
->with(666, 'foo123', 1)
- ->will($this->returnValue([
+ ->willReturn([
'calendardata' => 'BEGIN...',
- ]));
+ ]);
$calendarObject = new CachedSubscriptionObject($backend, $calendarInfo, $objectData);
$this->assertEquals('BEGIN...', $calendarObject->get());
diff --git a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
index ccf5967266940..9cb46767375ca 100644
--- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
+++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
@@ -158,14 +158,14 @@ public function testGetChild() {
$backend->expects($this->at(0))
->method('getCalendarObject')
->with(666, 'foo1', 1)
- ->will($this->returnValue([
+ ->willReturn([
'id' => 99,
'uri' => 'foo1'
- ]));
+ ]);
$backend->expects($this->at(1))
->method('getCalendarObject')
->with(666, 'foo2', 1)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -187,7 +187,7 @@ public function testGetChildren() {
$backend->expects($this->at(0))
->method('getCalendarObjects')
->with(666, 1)
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 99,
'uri' => 'foo1'
@@ -196,7 +196,7 @@ public function testGetChildren() {
'id' => 100,
'uri' => 'foo2'
],
- ]));
+ ]);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -218,7 +218,7 @@ public function testGetMultipleChildren() {
$backend->expects($this->at(0))
->method('getMultipleCalendarObjects')
->with(666, ['foo1', 'foo2'], 1)
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 99,
'uri' => 'foo1'
@@ -227,7 +227,7 @@ public function testGetMultipleChildren() {
'id' => 100,
'uri' => 'foo2'
],
- ]));
+ ]);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -266,14 +266,14 @@ public function testChildExists() {
$backend->expects($this->at(0))
->method('getCalendarObject')
->with(666, 'foo1', 1)
- ->will($this->returnValue([
+ ->willReturn([
'id' => 99,
'uri' => 'foo1'
- ]));
+ ]);
$backend->expects($this->at(1))
->method('getCalendarObject')
->with(666, 'foo2', 1)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -293,7 +293,7 @@ public function testCalendarQuery() {
$backend->expects($this->once())
->method('calendarQuery')
->with(666, ['foo'], 1)
- ->will($this->returnValue([99]));
+ ->willReturn([99]);
$calendar = new CachedSubscription($backend, $calendarInfo);
diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
index 8ac4961f19ff0..257c6665dfefa 100644
--- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
@@ -130,9 +130,9 @@ public function testCalendarSharing($userCanRead, $userCanWrite, $groupCanRead,
$l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function ($text, $parameters = array()) {
+ ->willReturnCallback(function ($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$config = $this->createMock(IConfig::class);
diff --git a/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php b/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
index 364286edd4b62..d366db8dba6bc 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
@@ -73,10 +73,10 @@ public function testCreateCalendarValidName() {
$mkCol = $this->createMock(MkCol::class);
$mkCol->method('getResourceType')
- ->will($this->returnValue(['{DAV:}collection',
- '{urn:ietf:params:xml:ns:caldav}calendar']));
+ ->willReturn(['{DAV:}collection',
+ '{urn:ietf:params:xml:ns:caldav}calendar']);
$mkCol->method('getRemainingValues')
- ->will($this->returnValue(['... properties ...']));
+ ->willReturn(['... properties ...']);
$this->backend->expects($this->once())
->method('createCalendar')
diff --git a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
index 5a32b5defa581..c32d812887436 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
@@ -74,7 +74,7 @@ public function testSearch() {
$this->backend->expects($this->once())
->method('search')
->with($this->calendarInfo, 'abc', ['def'], ['ghi'], 42, 1337)
- ->will($this->returnValue(['SEARCHRESULTS']));
+ ->willReturn(['SEARCHRESULTS']);
$result = $this->calendarImpl->search('abc', ['def'], ['ghi'], 42, 1337);
$this->assertEquals($result, ['SEARCHRESULTS']);
@@ -84,9 +84,9 @@ public function testGetPermissionRead() {
$this->calendar->expects($this->once())
->method('getACL')
->with()
- ->will($this->returnValue([
+ ->willReturn([
['privilege' => '{DAV:}read']
- ]));
+ ]);
$this->assertEquals(1, $this->calendarImpl->getPermissions());
}
@@ -95,9 +95,9 @@ public function testGetPermissionWrite() {
$this->calendar->expects($this->once())
->method('getACL')
->with()
- ->will($this->returnValue([
+ ->willReturn([
['privilege' => '{DAV:}write']
- ]));
+ ]);
$this->assertEquals(6, $this->calendarImpl->getPermissions());
}
@@ -106,10 +106,10 @@ public function testGetPermissionReadWrite() {
$this->calendar->expects($this->once())
->method('getACL')
->with()
- ->will($this->returnValue([
+ ->willReturn([
['privilege' => '{DAV:}read'],
['privilege' => '{DAV:}write']
- ]));
+ ]);
$this->assertEquals(7, $this->calendarImpl->getPermissions());
}
@@ -118,9 +118,9 @@ public function testGetPermissionAll() {
$this->calendar->expects($this->once())
->method('getACL')
->with()
- ->will($this->returnValue([
+ ->willReturn([
['privilege' => '{DAV:}all']
- ]));
+ ]);
$this->assertEquals(31, $this->calendarImpl->getPermissions());
}
diff --git a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
index 5d5a86524a1b0..146bfe24fff04 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
@@ -60,28 +60,28 @@ public function testSetupCalendarProvider() {
$this->backend->expects($this->once())
->method('getCalendarsForUser')
->with('principals/users/user123')
- ->will($this->returnValue([
+ ->willReturn([
['id' => 123, 'uri' => 'blablub1'],
['id' => 456, 'uri' => 'blablub2'],
- ]));
+ ]);
/** @var IManager | \PHPUnit_Framework_MockObject_MockObject $calendarManager */
$calendarManager = $this->createMock(Manager::class);
$calendarManager->expects($this->at(0))
->method('registerCalendar')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
$parameter = func_get_arg(0);
$this->assertInstanceOf(CalendarImpl::class, $parameter);
$this->assertEquals(123, $parameter->getKey());
- }));
+ });
$calendarManager->expects($this->at(1))
->method('registerCalendar')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
$parameter = func_get_arg(0);
$this->assertInstanceOf(CalendarImpl::class, $parameter);
$this->assertEquals(456, $parameter->getKey());
- }));
+ });
$this->manager->setupCalendarProvider($calendarManager, 'user123');
}
diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php
index 80e75beca5fb0..9a9f36c930922 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -53,9 +53,9 @@ protected function setUp(): void {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function ($text, $parameters = array()) {
+ ->willReturnCallback(function ($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
}
public function testDelete() {
@@ -568,7 +568,7 @@ public function testRemoveVAlarms() {
$backend->expects($this->any())
->method('getCalendarObject')
- ->will($this->returnCallback(function($cId, $uri) use($publicObject, $confidentialObject) {
+ ->willReturnCallback(function($cId, $uri) use($publicObject, $confidentialObject) {
switch($uri) {
case 'event-0':
return $publicObject;
@@ -579,7 +579,7 @@ public function testRemoveVAlarms() {
default:
throw new \Exception('unexpected uri');
}
- }));
+ });
$backend->expects($this->any())
->method('applyShareAcl')
diff --git a/apps/dav/tests/unit/CalDAV/OutboxTest.php b/apps/dav/tests/unit/CalDAV/OutboxTest.php
index 96bc8ed921d44..91e03182be431 100644
--- a/apps/dav/tests/unit/CalDAV/OutboxTest.php
+++ b/apps/dav/tests/unit/CalDAV/OutboxTest.php
@@ -47,7 +47,7 @@ public function testGetACLFreeBusyEnabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'disableFreeBusy', 'no')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->assertEquals([
[
@@ -82,7 +82,7 @@ public function testGetACLFreeBusyDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'disableFreeBusy', 'no')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->assertEquals([
[
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
index 2d04c605fcf77..dc1e89f34c4dc 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
@@ -118,15 +118,15 @@ public function testSendWithoutAttendees():void {
$enL10N = $this->createMock(IL10N::class);
$enL10N->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$enL10N->method('l')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$deL10N = $this->createMock(IL10N::class);
$deL10N->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$deL10N->method('l')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->l10nFactory->expects($this->at(0))
->method('findLanguage')
@@ -240,15 +240,15 @@ public function testSendWithAttendees(): void {
$enL10N = $this->createMock(IL10N::class);
$enL10N->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$enL10N->method('l')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$deL10N = $this->createMock(IL10N::class);
$deL10N->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$deL10N->method('l')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->l10nFactory->expects($this->at(0))
->method('findLanguage')
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
index 148e7627af6aa..b07fd70d9f1d4 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
@@ -285,11 +285,11 @@ public function testSearchPrincipals($expected, $test) {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->searchPrincipals($this->principalPrefix, [
'{http://sabredav.org/ns}email-address' => 'foo',
@@ -325,11 +325,11 @@ public function testSearchPrincipalsByMetadataKey() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->searchPrincipals($this->principalPrefix, [
'{http://nextcloud.com/ns}meta3' => 'value',
@@ -344,10 +344,10 @@ public function testSearchPrincipalsByCalendarUserAddressSet() {
$user = $this->createMock(IUser::class);
$this->userSession->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->searchPrincipals($this->principalPrefix, [
'{urn:ietf:params:xml:ns:caldav}calendar-user-address-set' => 'res2@foo.bar',
@@ -385,11 +385,11 @@ public function testFindByUriByEmail() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('mailto:res1@foo.bar', $this->principalPrefix);
$this->assertEquals($this->principalPrefix . '/backend1-res1', $actual);
@@ -400,11 +400,11 @@ public function testFindByUriByEmailForbiddenResource() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('mailto:res5@foo.bar', $this->principalPrefix);
$this->assertEquals(null, $actual);
@@ -415,11 +415,11 @@ public function testFindByUriByEmailNotFound() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('mailto:res99@foo.bar', $this->principalPrefix);
$this->assertEquals(null, $actual);
@@ -430,11 +430,11 @@ public function testFindByUriByPrincipal() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('mailto:res6@foo.bar', $this->principalPrefix);
$this->assertEquals($this->principalPrefix . '/backend3-res6', $actual);
@@ -445,11 +445,11 @@ public function testFindByUriByPrincipalForbiddenResource() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('principal:' . $this->principalPrefix . '/backend3-res5', $this->principalPrefix);
$this->assertEquals(null, $actual);
@@ -460,11 +460,11 @@ public function testFindByUriByPrincipalNotFound() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('principal:' . $this->principalPrefix . '/db-123', $this->principalPrefix);
$this->assertEquals(null, $actual);
@@ -475,11 +475,11 @@ public function testFindByUriByUnknownUri() {
$this->userSession->expects($this->once())
->method('getUser')
->with()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$actual = $this->principalBackend->findByUri('foobar:blub', $this->principalPrefix);
$this->assertEquals(null, $actual);
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
index b1da96f4c037c..0d48392686a7b 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
@@ -78,9 +78,9 @@ protected function setUp(): void {
$l10n = $this->createMock(IL10N::class);
$l10n->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$l10nFactory = $this->createMock(IFactory::class);
$l10nFactory->method('get')->willReturn($l10n);
@@ -90,16 +90,16 @@ protected function setUp(): void {
$db = $this->createMock(IDBConnection::class);
$db->method('getQueryBuilder')
->with()
- ->will($this->returnValue($this->queryBuilder));
+ ->willReturn($this->queryBuilder);
$random = $this->createMock(ISecureRandom::class);
$random->method('generate')
->with(60, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
- ->will($this->returnValue('random_token'));
+ ->willReturn('random_token');
$defaults = $this->createMock(Defaults::class);
$defaults->method('getName')
- ->will($this->returnValue('Instance Name 123'));
+ ->willReturn('Instance Name 123');
$this->plugin = new IMipPlugin($this->config, $this->mailer, $logger, $this->timeFactory, $l10nFactory, $urlGenerator, $defaults, $random, $db, $this->userManager, 'user123');
}
@@ -269,10 +269,10 @@ private function _expectSend( $recipient = 'frodo@hobb.it', $expectSend = true,
$this->queryBuilder->expects($this->at(0))
->method('insert')
->with('calendar_invitations')
- ->will($this->returnValue($this->queryBuilder));
+ ->willReturn($this->queryBuilder);
$this->queryBuilder->expects($this->at(8))
->method('values')
- ->will($this->returnValue($this->queryBuilder));
+ ->willReturn($this->queryBuilder);
$this->queryBuilder->expects($this->at(9))
->method('execute');
}
diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
index 91782531c1705..a5662519a7591 100644
--- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
@@ -88,15 +88,15 @@ public function testReport() {
$this->server->expects($this->at(0))
->method('getRequestUri')
->with()
- ->will($this->returnValue('/re/quest/u/r/i'));
+ ->willReturn('/re/quest/u/r/i');
$this->server->tree->expects($this->at(0))
->method('getNodeForPath')
->with('/re/quest/u/r/i')
- ->will($this->returnValue($calendarHome));
+ ->willReturn($calendarHome);
$this->server->expects($this->at(1))
->method('getHTTPDepth')
->with(2)
- ->will($this->returnValue(2));
+ ->willReturn(2);
$this->server
->method('getHTTPPrefer')
->willReturn([
@@ -104,7 +104,7 @@ public function testReport() {
]);
$calendarHome->expects($this->at(0))
->method('calendarSearch')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->plugin->report('{http://nextcloud.com/ns}calendar-search', $report, '');
}
@@ -113,7 +113,7 @@ public function testSupportedReportSetNoCalendarHome() {
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/foo/bar')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$reports = $this->plugin->getSupportedReportSet('/foo/bar');
$this->assertEquals([], $reports);
@@ -125,7 +125,7 @@ public function testSupportedReportSet() {
$this->server->tree->expects($this->once())
->method('getNodeForPath')
->with('/bar/foo')
- ->will($this->returnValue($calendarHome));
+ ->willReturn($calendarHome);
$reports = $this->plugin->getSupportedReportSet('/bar/foo');
$this->assertEquals([
diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php
index 410b233add97b..2002bccbd3e1f 100644
--- a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php
@@ -33,12 +33,12 @@ public function testDisabled() {
$request->expects($this->at(0))
->method('isUserAgent')
->with([])
- ->will($this->returnValue(false));
+ ->willReturn(false);
$request->expects($this->at(1))
->method('getHeader')
->with('X-NC-CalDAV-Webcal-Caching')
- ->will($this->returnValue(''));
+ ->willReturn('');
$plugin = new Plugin($request);
@@ -50,12 +50,12 @@ public function testEnabled() {
$request->expects($this->at(0))
->method('isUserAgent')
->with([])
- ->will($this->returnValue(false));
+ ->willReturn(false);
$request->expects($this->at(1))
->method('getHeader')
->with('X-NC-CalDAV-Webcal-Caching')
- ->will($this->returnValue('On'));
+ ->willReturn('On');
$plugin = new Plugin($request);
diff --git a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
index b1d341c2e4e8b..04f2a3cceab2e 100644
--- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
+++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
@@ -81,7 +81,7 @@ public function testRun(string $body, string $contentType, string $result) {
$this->caldavBackend->expects($this->once())
->method('getSubscriptionsForUser')
->with('principals/users/testuser')
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => '99',
'uri' => 'sub456',
@@ -100,35 +100,35 @@ public function testRun(string $body, string $contentType, string $result) {
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => '1',
'source' => 'webcal://foo.bar/bla2'
],
- ]));
+ ]);
$client = $this->createMock(IClient::class);
$response = $this->createMock(IResponse::class);
$this->clientService->expects($this->once())
->method('newClient')
->with()
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'webcalAllowLocalAccess', 'no')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$client->expects($this->once())
->method('get')
->with('https://foo.bar/bla2', $this->callback(function($obj) {
return $obj['allow_redirects']['redirects'] === 10 && $obj['handler'] instanceof HandlerStack;
}))
- ->will($this->returnValue($response));
+ ->willReturn($response);
$response->expects($this->once())
->method('getBody')
->with()
- ->will($this->returnValue($body));
+ ->willReturn($body);
$response->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue($contentType));
+ ->willReturn($contentType);
$this->caldavBackend->expects($this->once())
->method('purgeAllCachedEventsForSubscription')
@@ -176,7 +176,7 @@ public function testRunLocalURL($source) {
$this->caldavBackend->expects($this->once())
->method('getSubscriptionsForUser')
->with('principals/users/testuser')
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 42,
'uri' => 'sub123',
@@ -186,18 +186,18 @@ public function testRunLocalURL($source) {
'stripattachments' => 1,
'source' => $source
],
- ]));
+ ]);
$client = $this->createMock(IClient::class);
$this->clientService->expects($this->once())
->method('newClient')
->with()
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'webcalAllowLocalAccess', 'no')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$client->expects($this->never())
->method('get');
diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
index 9962cf4ca061a..e38bd1810a86a 100644
--- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
+++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
@@ -110,7 +110,7 @@ public function testOnCardDeleteGloballyDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->cardDav->expects($this->never())->method('getAddressBookById');
@@ -121,12 +121,12 @@ public function testOnCardDeleteUserDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->cardDav->expects($this->once())->method('getAddressBookById')
->with(666)
@@ -145,12 +145,12 @@ public function testOnCardDeleted() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->cardDav->expects($this->once())->method('getAddressBookById')
->with(666)
@@ -175,7 +175,7 @@ public function testOnCardChangedGloballyDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->cardDav->expects($this->never())->method('getAddressBookById');
@@ -191,12 +191,12 @@ public function testOnCardChangedUserDisabled() {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->cardDav->expects($this->once())->method('getAddressBookById')
->with(666)
@@ -223,12 +223,12 @@ public function testOnCardChanged($expectedOp) {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->config->expects($this->once())
->method('getUserValue')
->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->cardDav->expects($this->once())->method('getAddressBookById')
->with(666)
diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
index 1c0551671f839..9d0e56041d03a 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -82,23 +82,23 @@ public function testDelete() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->once())
->method('getId')
- ->will($this->returnValue('19'));
+ ->willReturn('19');
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->once())
->method('delete')
@@ -117,22 +117,22 @@ public function testDeleteForbidden() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('mallory'));
+ ->willReturn('mallory');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->never())
->method('getId');
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->never())
->method('delete');
@@ -144,7 +144,7 @@ public function testGetName() {
$id = '19';
$this->comment->expects($this->once())
->method('getId')
- ->will($this->returnValue($id));
+ ->willReturn($id);
$this->assertSame($this->node->getName(), $id);
}
@@ -169,11 +169,11 @@ public function testUpdateComment() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->once())
->method('setMessage')
@@ -181,11 +181,11 @@ public function testUpdateComment() {
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->once())
->method('save')
@@ -207,11 +207,11 @@ public function testUpdateCommentLogException() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->once())
->method('setMessage')
@@ -220,11 +220,11 @@ public function testUpdateCommentLogException() {
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->never())
->method('save');
@@ -246,11 +246,11 @@ public function testUpdateCommentMessageTooLongException() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->once())
->method('setMessage')
@@ -258,11 +258,11 @@ public function testUpdateCommentMessageTooLongException() {
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->never())
->method('save');
@@ -286,22 +286,22 @@ public function testUpdateForbiddenByUser() {
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('mallory'));
+ ->willReturn('mallory');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->never())
->method('setMessage');
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->comment->expects($this->any())
->method('getActorId')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->commentsManager->expects($this->never())
->method('save');
@@ -324,14 +324,14 @@ public function testUpdateForbiddenByType() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->comment->expects($this->never())
->method('setMessage');
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('bots'));
+ ->willReturn('bots');
$this->commentsManager->expects($this->never())
->method('save');
@@ -347,14 +347,14 @@ public function testUpdateForbiddenByNotLoggedIn() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->comment->expects($this->never())
->method('setMessage');
$this->comment->expects($this->any())
->method('getActorType')
- ->will($this->returnValue('users'));
+ ->willReturn('users');
$this->commentsManager->expects($this->never())
->method('save');
@@ -415,23 +415,23 @@ public function testGetProperties() {
$this->comment->expects($this->once())
->method('getId')
- ->will($this->returnValue($expected[$ns . 'id']));
+ ->willReturn($expected[$ns . 'id']);
$this->comment->expects($this->once())
->method('getParentId')
- ->will($this->returnValue($expected[$ns . 'parentId']));
+ ->willReturn($expected[$ns . 'parentId']);
$this->comment->expects($this->once())
->method('getTopmostParentId')
- ->will($this->returnValue($expected[$ns . 'topmostParentId']));
+ ->willReturn($expected[$ns . 'topmostParentId']);
$this->comment->expects($this->once())
->method('getChildrenCount')
- ->will($this->returnValue($expected[$ns . 'childrenCount']));
+ ->willReturn($expected[$ns . 'childrenCount']);
$this->comment->expects($this->once())
->method('getMessage')
- ->will($this->returnValue($expected[$ns . 'message']));
+ ->willReturn($expected[$ns . 'message']);
$this->comment->expects($this->once())
->method('getMentions')
@@ -442,43 +442,43 @@ public function testGetProperties() {
$this->comment->expects($this->once())
->method('getVerb')
- ->will($this->returnValue($expected[$ns . 'verb']));
+ ->willReturn($expected[$ns . 'verb']);
$this->comment->expects($this->exactly(2))
->method('getActorType')
- ->will($this->returnValue($expected[$ns . 'actorType']));
+ ->willReturn($expected[$ns . 'actorType']);
$this->comment->expects($this->exactly(2))
->method('getActorId')
- ->will($this->returnValue($expected[$ns . 'actorId']));
+ ->willReturn($expected[$ns . 'actorId']);
$this->comment->expects($this->once())
->method('getCreationDateTime')
- ->will($this->returnValue($expected[$ns . 'creationDateTime']));
+ ->willReturn($expected[$ns . 'creationDateTime']);
$this->comment->expects($this->once())
->method('getLatestChildDateTime')
- ->will($this->returnValue($expected[$ns . 'latestChildDateTime']));
+ ->willReturn($expected[$ns . 'latestChildDateTime']);
$this->comment->expects($this->once())
->method('getObjectType')
- ->will($this->returnValue($expected[$ns . 'objectType']));
+ ->willReturn($expected[$ns . 'objectType']);
$this->comment->expects($this->once())
->method('getObjectId')
- ->will($this->returnValue($expected[$ns . 'objectId']));
+ ->willReturn($expected[$ns . 'objectId']);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getDisplayName')
- ->will($this->returnValue($expected[$ns . 'actorDisplayName']));
+ ->willReturn($expected[$ns . 'actorDisplayName']);
$this->userManager->expects($this->once())
->method('get')
->with('alice')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$properties = $this->node->getProperties(null);
@@ -509,7 +509,7 @@ public function readCommentProvider() {
public function testGetPropertiesUnreadProperty($creationDT, $readDT, $expected) {
$this->comment->expects($this->any())
->method('getCreationDateTime')
- ->will($this->returnValue($creationDT));
+ ->willReturn($creationDT);
$this->comment->expects($this->any())
->method('getMentions')
@@ -517,15 +517,15 @@ public function testGetPropertiesUnreadProperty($creationDT, $readDT, $expected)
$this->commentsManager->expects($this->once())
->method('getReadMark')
- ->will($this->returnValue($readDT));
+ ->willReturn($readDT);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$properties = $this->node->getProperties(null);
diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
index 0ffcf145d81a7..4929eac3ecc55 100644
--- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
@@ -99,17 +99,17 @@ public function testCreateComment() {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$node->expects($this->once())
->method('setReadMarker')
@@ -118,11 +118,11 @@ public function testCreateComment() {
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -131,7 +131,7 @@ public function testCreateComment() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -143,20 +143,20 @@ public function testCreateComment() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->once())
->method('getUrl')
- ->will($this->returnValue('http://example.com/dav/' . $path));
+ ->willReturn('http://example.com/dav/' . $path);
$response->expects($this->once())
->method('setHeader')
@@ -164,7 +164,7 @@ public function testCreateComment() {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -229,7 +229,7 @@ public function testCreateCommentInvalidObject() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->never())
->method('getBodyAsString');
@@ -246,7 +246,7 @@ public function testCreateCommentInvalidObject() {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -285,10 +285,10 @@ public function testCreateCommentInvalidActor() {
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->never())
->method('create');
@@ -303,7 +303,7 @@ public function testCreateCommentInvalidActor() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -315,16 +315,16 @@ public function testCreateCommentInvalidActor() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->never())
->method('getUrl');
@@ -334,7 +334,7 @@ public function testCreateCommentInvalidActor() {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -373,10 +373,10 @@ public function testCreateCommentUnsupportedMediaType() {
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->never())
->method('create');
@@ -391,7 +391,7 @@ public function testCreateCommentUnsupportedMediaType() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -403,16 +403,16 @@ public function testCreateCommentUnsupportedMediaType() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/trumpscript'));
+ ->willReturn('application/trumpscript');
$request->expects($this->never())
->method('getUrl');
@@ -422,7 +422,7 @@ public function testCreateCommentUnsupportedMediaType() {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -457,26 +457,26 @@ public function testCreateCommentInvalidPayload() {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -485,7 +485,7 @@ public function testCreateCommentInvalidPayload() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -497,16 +497,16 @@ public function testCreateCommentInvalidPayload() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->never())
->method('getUrl');
@@ -516,7 +516,7 @@ public function testCreateCommentInvalidPayload() {
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -551,17 +551,17 @@ public function testCreateCommentMessageTooLong() {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$node->expects($this->once())
->method('getId')
- ->will($this->returnValue('42'));
+ ->willReturn('42');
$node->expects($this->never())
->method('setReadMarker');
@@ -569,11 +569,11 @@ public function testCreateCommentMessageTooLong() {
$this->commentsManager->expects($this->once())
->method('create')
->with('users', 'alice', 'files', '42')
- ->will($this->returnValue($comment));
+ ->willReturn($comment);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// technically, this is a shortcut. Inbetween EntityTypeCollection would
// be returned, but doing it exactly right would not be really
@@ -582,7 +582,7 @@ public function testCreateCommentMessageTooLong() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -594,23 +594,23 @@ public function testCreateCommentMessageTooLong() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$response->expects($this->never())
->method('setHeader');
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->httpPost($request, $response);
@@ -625,15 +625,15 @@ public function testOnReportInvalidNode() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, [], '/' . $path);
@@ -648,15 +648,15 @@ public function testOnReportInvalidReportName() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->plugin->onReport('{whoever}whatever', [], '/' . $path);
@@ -686,7 +686,7 @@ public function testOnReportDateTimeEmpty() {
$node->expects($this->once())
->method('findChildren')
->with(5, 10, null)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
@@ -706,11 +706,11 @@ public function testOnReportDateTimeEmpty() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->server->httpResponse = $response;
$this->plugin->initialize($this->server);
@@ -741,7 +741,7 @@ public function testOnReport() {
$node->expects($this->once())
->method('findChildren')
->with(5, 10, new \DateTime($parameters[2]['value']))
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
@@ -761,11 +761,11 @@ public function testOnReport() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->server->httpResponse = $response;
$this->plugin->initialize($this->server);
diff --git a/apps/dav/tests/unit/Comments/EntityCollectionTest.php b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
index a11d22b956aec..50f7a42d2228f 100644
--- a/apps/dav/tests/unit/Comments/EntityCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
@@ -79,11 +79,11 @@ public function testGetChild() {
$this->commentsManager->expects($this->once())
->method('get')
->with('55')
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$node = $this->collection->getChild('55');
$this->assertTrue($node instanceof \OCA\DAV\Comments\CommentNode);
@@ -105,11 +105,11 @@ public function testGetChildren() {
$this->commentsManager->expects($this->once())
->method('getForObject')
->with('files', '19')
- ->will($this->returnValue([
+ ->willReturn([
$this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
- ]));
+ ]);
$result = $this->collection->getChildren();
@@ -122,11 +122,11 @@ public function testFindChildren() {
$this->commentsManager->expects($this->once())
->method('getForObject')
->with('files', '19', 5, 15, $dt)
- ->will($this->returnValue([
+ ->willReturn([
$this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
- ]));
+ ]);
$result = $this->collection->findChildren(5, 15, $dt);
diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php
index c228aab9e20cd..1a7a3fb128e4f 100644
--- a/apps/dav/tests/unit/Comments/RootCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php
@@ -93,11 +93,11 @@ protected function setUp(): void {
protected function prepareForInitCollections() {
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
$event->addEntityCollection('files', function() {
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
index b110066aee100..9fca779d58a76 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -89,7 +89,7 @@ public function testIsDavAuthenticatedWithoutDavSession() {
->expects($this->once())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
@@ -99,7 +99,7 @@ public function testIsDavAuthenticatedWithWrongDavSession() {
->expects($this->exactly(2))
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('AnotherUser'));
+ ->willReturn('AnotherUser');
$this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
@@ -109,7 +109,7 @@ public function testIsDavAuthenticatedWithCorrectDavSession() {
->expects($this->exactly(2))
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->assertTrue($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser']));
}
@@ -120,20 +120,20 @@ public function testValidateUserPassOfAlreadyDAVAuthenticatedUser() {
->getMock();
$user->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->expects($this->exactly(2))
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->session
->expects($this->exactly(2))
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->session
->expects($this->once())
->method('close');
@@ -147,20 +147,20 @@ public function testValidateUserPassOfInvalidDAVAuthenticatedUser() {
->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->session
->expects($this->exactly(2))
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('AnotherUser'));
+ ->willReturn('AnotherUser');
$this->session
->expects($this->once())
->method('close');
@@ -174,25 +174,25 @@ public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPasswo
->getMock();
$user->expects($this->exactly(3))
->method('getUID')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->expects($this->exactly(3))
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->session
->expects($this->exactly(2))
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('AnotherUser'));
+ ->willReturn('AnotherUser');
$this->userSession
->expects($this->once())
->method('logClientIn')
->with('MyTestUser', 'MyTestPassword', $this->request)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session
->expects($this->once())
->method('set')
@@ -208,12 +208,12 @@ public function testValidateUserPassWithInvalidPassword() {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession
->expects($this->once())
->method('logClientIn')
->with('MyTestUser', 'MyTestPassword')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session
->expects($this->once())
->method('close');
@@ -228,7 +228,7 @@ public function testValidateUserPassWithPasswordLoginForbidden() {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession
->expects($this->once())
->method('logClientIn')
@@ -251,7 +251,7 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet() {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request
->expects($this->any())
->method('getMethod')
@@ -260,17 +260,17 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet() {
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('MyWrongDavUser'));
+ ->willReturn('MyWrongDavUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -312,17 +312,17 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAu
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('LoggedInUser'));
+ ->willReturn('LoggedInUser');
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('LoggedInUser'));
+ ->willReturn('LoggedInUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -362,17 +362,17 @@ public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed()
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('LoggedInUser'));
+ ->willReturn('LoggedInUser');
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('LoggedInUser'));
+ ->willReturn('LoggedInUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -380,7 +380,7 @@ public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed()
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->auth->check($request, $response);
}
@@ -416,17 +416,17 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDav
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('AnotherUser'));
+ ->willReturn('AnotherUser');
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('LoggedInUser'));
+ ->willReturn('LoggedInUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -444,7 +444,7 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDeskt
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request
->expects($this->any())
->method('getMethod')
@@ -462,17 +462,17 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDeskt
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('MyWrongDavUser'));
+ ->willReturn('MyWrongDavUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -491,22 +491,22 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForGet() {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('MyWrongDavUser'));
+ ->willReturn('MyWrongDavUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->any())
->method('getMethod')
@@ -526,22 +526,22 @@ public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet() {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session
->expects($this->any())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('MyWrongDavUser'));
+ ->willReturn('MyWrongDavUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->request
->expects($this->once())
->method('passesCSRFCheck')
@@ -581,12 +581,12 @@ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax() {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$httpRequest
->expects($this->once())
->method('getHeader')
->with('X-Requested-With')
- ->will($this->returnValue('XMLHttpRequest'));
+ ->willReturn('XMLHttpRequest');
$this->auth->check($httpRequest, $httpResponse);
}
@@ -607,7 +607,7 @@ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUse
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->expects($this->any())
->method('getUser')
@@ -616,7 +616,7 @@ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUse
->expects($this->atLeastOnce())
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->request
->expects($this->once())
->method('getMethod')
@@ -625,7 +625,7 @@ public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUse
->expects($this->atLeastOnce())
->method('getHeader')
->with('Authorization')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->assertEquals(
[true, 'principals/users/MyTestUser'],
$this->auth->check($httpRequest, $httpResponse)
@@ -643,12 +643,12 @@ public function testAuthenticateValidCredentials() {
->expects($this->at(0))
->method('getHeader')
->with('X-Requested-With')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$server->httpRequest
->expects($this->at(1))
->method('getHeader')
->with('Authorization')
- ->will($this->returnValue('basic dXNlcm5hbWU6cGFzc3dvcmQ='));
+ ->willReturn('basic dXNlcm5hbWU6cGFzc3dvcmQ=');
$server->httpResponse = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -656,17 +656,17 @@ public function testAuthenticateValidCredentials() {
->expects($this->once())
->method('logClientIn')
->with('username', 'password')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
->method('getUID')
- ->will($this->returnValue('MyTestUser'));
+ ->willReturn('MyTestUser');
$this->userSession
->expects($this->exactly(4))
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$response = $this->auth->check($server->httpRequest, $server->httpResponse);
$this->assertEquals([true, 'principals/users/MyTestUser'], $response);
}
@@ -682,12 +682,12 @@ public function testAuthenticateInvalidCredentials() {
->expects($this->at(0))
->method('getHeader')
->with('X-Requested-With')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$server->httpRequest
->expects($this->at(1))
->method('getHeader')
->with('Authorization')
- ->will($this->returnValue('basic dXNlcm5hbWU6cGFzc3dvcmQ='));
+ ->willReturn('basic dXNlcm5hbWU6cGFzc3dvcmQ=');
$server->httpResponse = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -695,7 +695,7 @@ public function testAuthenticateInvalidCredentials() {
->expects($this->once())
->method('logClientIn')
->with('username', 'password')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$response = $this->auth->check($server->httpRequest, $server->httpResponse);
$this->assertEquals([false, 'Username or password was incorrect'], $response);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
index d06c70d7ad174..605b365475f72 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
@@ -78,13 +78,13 @@ public function testBeforeHandlerException($userAgent) {
->expects($this->once())
->method('getHeader')
->with('User-Agent')
- ->will($this->returnValue($userAgent));
+ ->willReturn($userAgent);
$this->config
->expects($this->once())
->method('getSystemValue')
->with('minimum.supported.desktop.version', '2.0.0')
- ->will($this->returnValue('1.7.0'));
+ ->willReturn('1.7.0');
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
}
@@ -113,13 +113,13 @@ public function testBeforeHandlerSuccess($userAgent) {
->expects($this->once())
->method('getHeader')
->with('User-Agent')
- ->will($this->returnValue($userAgent));
+ ->willReturn($userAgent);
$this->config
->expects($this->once())
->method('getSystemValue')
->with('minimum.supported.desktop.version', '2.0.0')
- ->will($this->returnValue('1.7.0'));
+ ->willReturn('1.7.0');
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
}
@@ -131,7 +131,7 @@ public function testBeforeHandlerNoUserAgent() {
->expects($this->once())
->method('getHeader')
->with('User-Agent')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
index 250ccffcd7870..9260acd94922b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
@@ -114,11 +114,11 @@ public function testGetCommentsLink($baseUri, $fid, $expectedHref) {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue($fid));
+ ->willReturn($fid);
$this->server->expects($this->once())
->method('getBaseUri')
- ->will($this->returnValue($baseUri));
+ ->willReturn($baseUri);
$href = $this->plugin->getCommentsLink($node);
$this->assertSame($expectedHref, $href);
@@ -145,15 +145,15 @@ public function testGetUnreadCount($user) {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue('4567'));
+ ->willReturn('4567');
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->commentsManager->expects($this->any())
->method('getNumberOfCommentsForObject')
- ->will($this->returnValue(42));
+ ->willReturn(42);
$unread = $this->plugin->getUnreadCount($node);
if(is_null($user)) {
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index a78d64f9c9489..5cd4e69b7f5ae 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -81,7 +81,7 @@ protected function setUp(): void {
->getMock();
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue($userId));
+ ->willReturn($userId);
$this->plugin = new \OCA\DAV\DAV\CustomPropertiesBackend(
$this->tree,
@@ -110,11 +110,11 @@ private function createTestNode($class) {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$node->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/dummypath'));
+ ->willReturn('/dummypath');
return $node;
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index 528327a681afc..1bf0b53396652 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -89,11 +89,11 @@ protected function setUp(): void {
private function getDir($path = '/') {
$this->view->expects($this->once())
->method('getRelativePath')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->info->expects($this->once())
->method('getPath')
- ->will($this->returnValue($path));
+ ->willReturn($path);
return new Directory($this->view, $this->info);
}
@@ -104,7 +104,7 @@ public function testDeleteRootFolderFails() {
$this->info->expects($this->any())
->method('isDeletable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->never())
->method('rmdir');
$dir = $this->getDir();
@@ -118,7 +118,7 @@ public function testDeleteForbidden() {
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
// but fails
$this->view->expects($this->once())
@@ -135,13 +135,13 @@ public function testDeleteFolderWhenAllowed() {
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
// but fails
$this->view->expects($this->once())
->method('rmdir')
->with('sub')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$dir = $this->getDir('sub');
$dir->delete();
@@ -153,7 +153,7 @@ public function testDeleteFolderFailsWhenNotAllowed() {
$this->info->expects($this->once())
->method('isDeletable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$dir = $this->getDir('sub');
$dir->delete();
@@ -166,13 +166,13 @@ public function testDeleteFolderThrowsWhenDeletionFailed() {
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
// but fails
$this->view->expects($this->once())
->method('rmdir')
->with('sub')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$dir = $this->getDir('sub');
$dir->delete();
@@ -187,25 +187,25 @@ public function testGetChildren() {
->getMock();
$info1->expects($this->any())
->method('getName')
- ->will($this->returnValue('first'));
+ ->willReturn('first');
$info1->expects($this->any())
->method('getEtag')
- ->will($this->returnValue('abc'));
+ ->willReturn('abc');
$info2->expects($this->any())
->method('getName')
- ->will($this->returnValue('second'));
+ ->willReturn('second');
$info2->expects($this->any())
->method('getEtag')
- ->will($this->returnValue('def'));
+ ->willReturn('def');
$this->view->expects($this->once())
->method('getDirectoryContent')
->with('')
- ->will($this->returnValue(array($info1, $info2)));
+ ->willReturn(array($info1, $info2));
$this->view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnValue(''));
+ ->willReturn('');
$dir = new Directory($this->view, $this->info);
$nodes = $dir->getChildren();
@@ -224,7 +224,7 @@ public function testGetChildrenNoPermission() {
$info = $this->createMock(FileInfo::class);
$info->expects($this->any())
->method('isReadable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$dir = new Directory($this->view, $info);
$dir->getChildren();
@@ -236,7 +236,7 @@ public function testGetChildNoPermission() {
$this->info->expects($this->any())
->method('isReadable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$dir = new Directory($this->view, $this->info);
$dir->getChild('test');
@@ -275,25 +275,25 @@ public function testGetQuotaInfoUnlimited() {
$storage->expects($this->any())
->method('instanceOfStorage')
- ->will($this->returnValueMap([
+ ->willReturnMap([
'\OCA\Files_Sharing\SharedStorage' => false,
'\OC\Files\Storage\Wrapper\Quota' => false,
- ]));
+ ]);
$storage->expects($this->never())
->method('getQuota');
$storage->expects($this->once())
->method('free_space')
- ->will($this->returnValue(800));
+ ->willReturn(800);
$this->info->expects($this->once())
->method('getSize')
- ->will($this->returnValue(200));
+ ->willReturn(200);
$this->info->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
@@ -306,26 +306,26 @@ public function testGetQuotaInfoSpecific() {
$storage->expects($this->any())
->method('instanceOfStorage')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['\OCA\Files_Sharing\SharedStorage', false],
['\OC\Files\Storage\Wrapper\Quota', true],
- ]));
+ ]);
$storage->expects($this->once())
->method('getQuota')
- ->will($this->returnValue(1000));
+ ->willReturn(1000);
$storage->expects($this->once())
->method('free_space')
- ->will($this->returnValue(800));
+ ->willReturn(800);
$this->info->expects($this->once())
->method('getSize')
- ->will($this->returnValue(200));
+ ->willReturn(200);
$this->info->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
index 2c9ca1be27f59..473c0164d06a8 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
@@ -168,7 +168,7 @@ public function testFakeLockProvider() {
$request->expects($this->exactly(2))
->method('getPath')
- ->will($this->returnValue('MyPath'));
+ ->willReturn('MyPath');
$this->assertSame(false, $this->fakeLockerPlugin->fakeLockProvider($request, $response));
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 8842d8be31653..96f5a2c385c95 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -182,11 +182,11 @@ public function testSimplePutFails($thrownException, $expectedException, $checkP
->getMock();
$view->expects($this->atLeastOnce())
->method('resolvePath')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function ($path) use ($storage) {
return [$storage, $path];
}
- ));
+ );
if ($thrownException !== null) {
$storage->expects($this->once())
@@ -195,12 +195,12 @@ function ($path) use ($storage) {
} else {
$storage->expects($this->once())
->method('writeStream')
- ->will($this->returnValue(0));
+ ->willReturn(0);
}
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -241,11 +241,11 @@ public function testChunkedPutFails($thrownException, $expectedException, $check
->getMock();
$view->expects($this->atLeastOnce())
->method('resolvePath')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function ($path) use ($storage) {
return [$storage, $path];
}
- ));
+ );
if ($thrownException !== null) {
$storage->expects($this->once())
@@ -254,12 +254,12 @@ function ($path) use ($storage) {
} else {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnValue(false));
+ ->willReturn(false);
}
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$_SERVER['HTTP_OC_CHUNKED'] = true;
@@ -671,14 +671,14 @@ public function testSimplePutFailsSizeCheck() {
$view->expects($this->any())
->method('rename')
->withAnyParameters()
- ->will($this->returnValue(false));
+ ->willReturn(false);
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$view->expects($this->any())
->method('filesize')
- ->will($this->returnValue(123456));
+ ->willReturn(123456);
$_SERVER['CONTENT_LENGTH'] = 123456;
$_SERVER['REQUEST_METHOD'] = 'PUT';
@@ -788,7 +788,7 @@ public function testSimplePutInvalidChars() {
->getMock();
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -827,7 +827,7 @@ public function testSetNameInvalidChars() {
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -845,13 +845,13 @@ public function testUploadAbort() {
$view->expects($this->any())
->method('rename')
->withAnyParameters()
- ->will($this->returnValue(false));
+ ->willReturn(false);
$view->expects($this->any())
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$view->expects($this->any())
->method('filesize')
- ->will($this->returnValue(123456));
+ ->willReturn(123456);
$_SERVER['CONTENT_LENGTH'] = 12345;
$_SERVER['REQUEST_METHOD'] = 'PUT';
@@ -888,7 +888,7 @@ public function testDeleteWhenAllowed() {
$view->expects($this->once())
->method('unlink')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -929,7 +929,7 @@ public function testDeleteThrowsWhenDeletionFailed() {
// but fails
$view->expects($this->once())
->method('unlink')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
@@ -1016,20 +1016,20 @@ public function testPutLocking() {
// so only shared lock is acceptable
$eventHandler->expects($this->once())
->method('writeCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$wasLockedPre) {
$wasLockedPre = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
$wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
}
- ));
+ );
$eventHandler->expects($this->once())
->method('postWriteCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$wasLockedPost) {
$wasLockedPost = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
$wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
}
- ));
+ );
\OCP\Util::connectHook(
Filesystem::CLASSNAME,
@@ -1120,7 +1120,7 @@ public function testGetFopenFails() {
->getMock();
$view->expects($this->atLeastOnce())
->method('fopen')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
'permissions' => \OCP\Constants::PERMISSION_ALL
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
index 35362da177c3f..d1e863b18bac4 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -143,25 +143,25 @@ private function createTestNode($class, $path = '/dummypath') {
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with($path)
- ->will($this->returnValue($node));
+ ->willReturn($node);
$node->expects($this->any())
->method('getFileId')
- ->will($this->returnValue('00000123instanceid'));
+ ->willReturn('00000123instanceid');
$node->expects($this->any())
->method('getInternalFileId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$node->expects($this->any())
->method('getEtag')
- ->will($this->returnValue('"abc"'));
+ ->willReturn('"abc"');
$node->expects($this->any())
->method('getDavPermissions')
- ->will($this->returnValue('DWCKMSR'));
+ ->willReturn('DWCKMSR');
$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->expects($this->any())
@@ -200,18 +200,18 @@ public function testGetPropertiesForFile() {
$user
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$user
->expects($this->once())
->method('getDisplayName')
- ->will($this->returnValue('M. Foo'));
+ ->willReturn('M. Foo');
$node->expects($this->once())
->method('getDirectDownload')
- ->will($this->returnValue(array('url' => 'http://example.com/')));
+ ->willReturn(array('url' => 'http://example.com/'));
$node->expects($this->exactly(2))
->method('getOwner')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->plugin->handleGetProperties(
$propFind,
@@ -277,7 +277,7 @@ public function testGetPublicPermissions() {
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$node->expects($this->any())
->method('getDavPermissions')
- ->will($this->returnValue('DWCKMSR'));
+ ->willReturn('DWCKMSR');
$this->plugin->handleGetProperties(
$propFind,
@@ -306,7 +306,7 @@ public function testGetPropertiesForDirectory() {
$node->expects($this->once())
->method('getSize')
- ->will($this->returnValue(1025));
+ ->willReturn(1025);
$this->plugin->handleGetProperties(
$propFind,
@@ -402,7 +402,7 @@ public function testUpdateProps() {
$node->expects($this->once())
->method('setEtag')
->with('newetag')
- ->will($this->returnValue(true));
+ ->willReturn(true);
// properties to set
$propPatch = new PropPatch(array(
@@ -553,7 +553,7 @@ public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader) {
$request
->expects($this->once())
->method('getPath')
- ->will($this->returnValue('test/somefile.xml'));
+ ->willReturn('test/somefile.xml');
$node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
@@ -561,18 +561,18 @@ public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader) {
$node
->expects($this->once())
->method('getName')
- ->will($this->returnValue('somefile.xml'));
+ ->willReturn('somefile.xml');
$this->tree
->expects($this->once())
->method('getNodeForPath')
->with('test/somefile.xml')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->request
->expects($this->once())
->method('isUserAgent')
- ->will($this->returnValue($isClumsyAgent));
+ ->willReturn($isClumsyAgent);
$response
->expects($this->once())
@@ -596,7 +596,7 @@ public function testHasPreview() {
$this->previewManager->expects($this->once())
->method('isAvailable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->plugin->handleGetProperties(
$propFind,
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 14dd87ccb98b8..2614640ba0b1e 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -102,7 +102,7 @@ protected function setUp(): void {
$this->server->expects($this->any())
->method('getBaseUri')
- ->will($this->returnValue('http://example.com/owncloud/remote.php/dav'));
+ ->willReturn('http://example.com/owncloud/remote.php/dav');
$this->groupManager = $this->getMockBuilder(IGroupManager::class)
->disableOriginalConstructor()
@@ -128,17 +128,17 @@ protected function setUp(): void {
$privateTagManager->expects($this->any())
->method('load')
->with('files')
- ->will($this->returnValue($this->privateTags));
+ ->willReturn($this->privateTags);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('testuser'));
+ ->willReturn('testuser');
$this->userSession->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->plugin = new FilesReportPluginImplementation(
$this->tree,
@@ -159,15 +159,15 @@ public function testOnReportInvalidNode() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->assertNull($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, [], '/' . $path));
@@ -179,15 +179,15 @@ public function testOnReportInvalidReportName() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue(
+ ->willReturn(
$this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
- ));
+ );
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->plugin->initialize($this->server);
$this->assertNull($this->plugin->onReport('{whoever}whatever', [], '/' . $path));
@@ -215,16 +215,16 @@ public function testOnReport() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->at(0))
->method('getObjectIdsForTags')
->with('123', 'files')
- ->will($this->returnValue(['111', '222']));
+ ->willReturn(['111', '222']);
$this->tagMapper->expects($this->at(1))
->method('getObjectIdsForTags')
->with('456', 'files')
- ->will($this->returnValue(['111', '222', '333']));
+ ->willReturn(['111', '222', '333']);
$reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
@@ -248,7 +248,7 @@ public function testOnReport() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/' . $path)
- ->will($this->returnValue($reportTargetNode));
+ ->willReturn($reportTargetNode);
$filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
@@ -260,15 +260,15 @@ public function testOnReport() {
$this->userFolder->expects($this->at(0))
->method('getById')
->with('111')
- ->will($this->returnValue([$filesNode1]));
+ ->willReturn([$filesNode1]);
$this->userFolder->expects($this->at(1))
->method('getById')
->with('222')
- ->will($this->returnValue([$filesNode2]));
+ ->willReturn([$filesNode2]);
$this->server->expects($this->any())
->method('getRequestUri')
- ->will($this->returnValue($path));
+ ->willReturn($path);
$this->server->httpResponse = $response;
$this->plugin->initialize($this->server);
@@ -281,30 +281,30 @@ public function testFindNodesByFileIdsRoot() {
->getMock();
$filesNode1->expects($this->once())
->method('getName')
- ->will($this->returnValue('first node'));
+ ->willReturn('first node');
$filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
- ->will($this->returnValue('second node'));
+ ->willReturn('second node');
$reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/'));
+ ->willReturn('/');
$this->userFolder->expects($this->at(0))
->method('getById')
->with('111')
- ->will($this->returnValue([$filesNode1]));
+ ->willReturn([$filesNode1]);
$this->userFolder->expects($this->at(1))
->method('getById')
->with('222')
- ->will($this->returnValue([$filesNode2]));
+ ->willReturn([$filesNode2]);
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $reportTargetNode */
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
@@ -322,21 +322,21 @@ public function testFindNodesByFileIdsSubDir() {
->getMock();
$filesNode1->expects($this->once())
->method('getName')
- ->will($this->returnValue('first node'));
+ ->willReturn('first node');
$filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
- ->will($this->returnValue('second node'));
+ ->willReturn('second node');
$reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/sub1/sub2'));
+ ->willReturn('/sub1/sub2');
$subNode = $this->getMockBuilder(Folder::class)
@@ -346,16 +346,16 @@ public function testFindNodesByFileIdsSubDir() {
$this->userFolder->expects($this->at(0))
->method('get')
->with('/sub1/sub2')
- ->will($this->returnValue($subNode));
+ ->willReturn($subNode);
$subNode->expects($this->at(0))
->method('getById')
->with('111')
- ->will($this->returnValue([$filesNode1]));
+ ->willReturn([$filesNode1]);
$subNode->expects($this->at(1))
->method('getById')
->with('222')
- ->will($this->returnValue([$filesNode2]));
+ ->willReturn([$filesNode2]);
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $reportTargetNode */
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
@@ -382,20 +382,20 @@ public function testPrepareResponses() {
$node1->expects($this->once())
->method('getInternalFileId')
- ->will($this->returnValue('111'));
+ ->willReturn('111');
$node1->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/node1'));
+ ->willReturn('/node1');
$node1->method('getFileInfo')->willReturn($fileInfo);
$node2->expects($this->once())
->method('getInternalFileId')
- ->will($this->returnValue('222'));
+ ->willReturn('222');
$node2->expects($this->once())
->method('getSize')
- ->will($this->returnValue(1024));
+ ->willReturn(1024);
$node2->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/sub/node2'));
+ ->willReturn('/sub/node2');
$node2->method('getFileInfo')->willReturn($fileInfo);
$config = $this->getMockBuilder(IConfig::class)
@@ -440,7 +440,7 @@ public function testPrepareResponses() {
public function testProcessFilterRulesSingle() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->exactly(1))
->method('getObjectIdsForTags')
@@ -461,7 +461,7 @@ public function testProcessFilterRulesSingle() {
public function testProcessFilterRulesAndCondition() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->exactly(2))
->method('getObjectIdsForTags')
@@ -485,7 +485,7 @@ public function testProcessFilterRulesAndCondition() {
public function testProcessFilterRulesAndConditionWithOneEmptyResult() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->exactly(2))
->method('getObjectIdsForTags')
@@ -509,7 +509,7 @@ public function testProcessFilterRulesAndConditionWithOneEmptyResult() {
public function testProcessFilterRulesAndConditionWithFirstEmptyResult() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->exactly(1))
->method('getObjectIdsForTags')
@@ -533,7 +533,7 @@ public function testProcessFilterRulesAndConditionWithFirstEmptyResult() {
public function testProcessFilterRulesAndConditionWithEmptyMidResult() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->exactly(2))
->method('getObjectIdsForTags')
@@ -560,27 +560,27 @@ public function testProcessFilterRulesAndConditionWithEmptyMidResult() {
public function testProcessFilterRulesInvisibleTagAsAdmin() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag1->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag2->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// no need to fetch tags to check permissions
$this->tagManager->expects($this->never())
@@ -589,11 +589,11 @@ public function testProcessFilterRulesInvisibleTagAsAdmin() {
$this->tagMapper->expects($this->at(0))
->method('getObjectIdsForTags')
->with('123')
- ->will($this->returnValue(['111', '222']));
+ ->willReturn(['111', '222']);
$this->tagMapper->expects($this->at(1))
->method('getObjectIdsForTags')
->with('456')
- ->will($this->returnValue(['222', '333']));
+ ->willReturn(['222', '333']);
$rules = [
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
@@ -609,32 +609,32 @@ public function testProcessFilterRulesInvisibleTagAsUser() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag1->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag2->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(false)); // invisible
+ ->willReturn(false); // invisible
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123', '456'])
- ->will($this->returnValue([$tag1, $tag2]));
+ ->willReturn([$tag1, $tag2]);
$rules = [
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
@@ -647,41 +647,41 @@ public function testProcessFilterRulesInvisibleTagAsUser() {
public function testProcessFilterRulesVisibleTagAsUser() {
$this->groupManager->expects($this->any())
->method('isAdmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag1->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
->method('getId')
- ->will($this->returnValue('123'));
+ ->willReturn('123');
$tag2->expects($this->any())
->method('isUserVisible')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123', '456'])
- ->will($this->returnValue([$tag1, $tag2]));
+ ->willReturn([$tag1, $tag2]);
$this->tagMapper->expects($this->at(0))
->method('getObjectIdsForTags')
->with('123')
- ->will($this->returnValue(['111', '222']));
+ ->willReturn(['111', '222']);
$this->tagMapper->expects($this->at(1))
->method('getObjectIdsForTags')
->with('456')
- ->will($this->returnValue(['222', '333']));
+ ->willReturn(['222', '333']);
$rules = [
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
@@ -698,7 +698,7 @@ public function testProcessFavoriteFilter() {
$this->privateTags->expects($this->once())
->method('getFavorites')
- ->will($this->returnValue(['456', '789']));
+ ->willReturn(['456', '789']);
$this->assertEquals(['456', '789'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
index d34880886768a..9564ad0cec32e 100644
--- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
@@ -56,7 +56,7 @@ public function testMaintenanceMode() {
->expects($this->exactly(1))
->method('getSystemValueBool')
->with('maintenance')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->maintenancePlugin->checkMaintenanceMode();
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index f0991d05992b1..5d71a705362f6 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -67,16 +67,16 @@ public function testDavPermissions($permissions, $type, $shared, $mounted, $expe
->getMock();
$info->expects($this->any())
->method('getPermissions')
- ->will($this->returnValue($permissions));
+ ->willReturn($permissions);
$info->expects($this->any())
->method('isShared')
- ->will($this->returnValue($shared));
+ ->willReturn($shared);
$info->expects($this->any())
->method('isMounted')
- ->will($this->returnValue($mounted));
+ ->willReturn($mounted);
$info->expects($this->any())
->method('getType')
- ->will($this->returnValue($type));
+ ->willReturn($type);
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
index 1ccfa2e479e9e..76ebbe301893b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -64,7 +64,7 @@ public function testCopy($sourcePath, $targetPath, $targetParent) {
$view->expects($this->once())
->method('verifyPath')
->with($targetParent)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$view->expects($this->once())
->method('file_exists')
->with($targetPath)
@@ -72,7 +72,7 @@ public function testCopy($sourcePath, $targetPath, $targetParent) {
$view->expects($this->once())
->method('copy')
->with($sourcePath, $targetPath)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$info = $this->createMock(FileInfo::class);
$info->expects($this->once())
@@ -93,7 +93,7 @@ public function testCopy($sourcePath, $targetPath, $targetParent) {
$objectTree->expects($this->once())
->method('getNodeForPath')
->with($this->identicalTo($sourcePath))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @var $objectTree \OCA\DAV\Connector\Sabre\ObjectTree */
$mountManager = Filesystem::getMountManager();
@@ -171,17 +171,17 @@ public function testGetNodeForPath(
->getMock();
$fileInfo->expects($this->once())
->method('getType')
- ->will($this->returnValue($type));
+ ->willReturn($type);
$fileInfo->expects($this->once())
->method('getName')
- ->will($this->returnValue($outputFileName));
+ ->willReturn($outputFileName);
$fileInfo->method('getStorage')
->willReturn($this->createMock(\OC\Files\Storage\Common::class));
$view->expects($this->once())
->method('getFileInfo')
->with($fileInfoQueryPath)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
$tree->init($rootNode, $view, $mountManager);
@@ -283,9 +283,9 @@ public function testGetNodeForPathInvalidPath() {
->getMock();
$view->expects($this->once())
->method('resolvePath')
- ->will($this->returnCallback(function($path) use ($storage){
+ ->willReturnCallback(function($path) use ($storage){
return [$storage, ltrim($path, '/')];
- }));
+ });
$rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
@@ -310,9 +310,9 @@ public function testGetNodeForPathRoot() {
->getMock();
$view->expects($this->any())
->method('resolvePath')
- ->will($this->returnCallback(function ($path) use ($storage) {
+ ->willReturnCallback(function ($path) use ($storage) {
return [$storage, ltrim($path, '/')];
- }));
+ });
$rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
index 99d8ea72bb08d..57613c19f6466 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -100,29 +100,29 @@ public function testGetPrincipalsByPrefixWithUsers() {
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$fooUser
->expects($this->exactly(1))
->method('getDisplayName')
- ->will($this->returnValue('Dr. Foo-Bar'));
+ ->willReturn('Dr. Foo-Bar');
$fooUser
->expects($this->exactly(1))
->method('getEMailAddress')
- ->will($this->returnValue(''));
+ ->willReturn('');
$barUser = $this->createMock(User::class);
$barUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('bar'));
+ ->willReturn('bar');
$barUser
->expects($this->exactly(1))
->method('getEMailAddress')
- ->will($this->returnValue('bar@nextcloud.com'));
+ ->willReturn('bar@nextcloud.com');
$this->userManager
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([$fooUser, $barUser]));
+ ->willReturn([$fooUser, $barUser]);
$expectedResponse = [
0 => [
@@ -146,7 +146,7 @@ public function testGetPrincipalsByPrefixEmpty() {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->connector->getPrincipalsByPrefix('principals/users');
$this->assertSame([], $response);
@@ -157,12 +157,12 @@ public function testGetPrincipalsByPathWithoutMail() {
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$expectedResponse = [
'uri' => 'principals/users/foo',
@@ -178,16 +178,16 @@ public function testGetPrincipalsByPathWithMail() {
$fooUser
->expects($this->exactly(1))
->method('getEMailAddress')
- ->will($this->returnValue('foo@nextcloud.com'));
+ ->willReturn('foo@nextcloud.com');
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$expectedResponse = [
'uri' => 'principals/users/foo',
@@ -204,7 +204,7 @@ public function testGetPrincipalsByPathEmpty() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$response = $this->connector->getPrincipalByPath('principals/users/foo');
$this->assertSame(null, $response);
@@ -224,7 +224,7 @@ public function testGetGroupMemberSetEmpty() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->connector->getGroupMemberSet('principals/users/foo/calendar-proxy-read');
}
@@ -234,12 +234,12 @@ public function testGetGroupMemberSetProxyRead() {
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$proxy1 = new Proxy();
$proxy1->setProxyId('proxyId1');
@@ -266,12 +266,12 @@ public function testGetGroupMemberSetProxyWrite() {
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$proxy1 = new Proxy();
$proxy1->setProxyId('proxyId1');
@@ -349,7 +349,7 @@ public function testGetGroupMembershipEmpty() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->connector->getGroupMembership('principals/users/foo');
}
@@ -367,22 +367,22 @@ public function testSetGroupMembershipProxy() {
$fooUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$barUser = $this->createMock(User::class);
$barUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('bar'));
+ ->willReturn('bar');
$this->userManager
->expects($this->at(0))
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$this->userManager
->expects($this->at(1))
->method('get')
->with('bar')
- ->will($this->returnValue($barUser));
+ ->willReturn($barUser);
$this->proxyMapper->expects($this->at(0))
->method('getProxiesOf')
@@ -428,7 +428,7 @@ public function testSearchPrincipalsWithWrongPrefixPath() {
public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $result) {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
- ->will($this->returnValue($sharingEnabled));
+ ->willReturn($sharingEnabled);
if ($sharingEnabled) {
$this->shareManager->expects($this->once())
@@ -437,18 +437,18 @@ public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $resul
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue($groupsOnly));
+ ->willReturn($groupsOnly);
if ($groupsOnly) {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->at(0))
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2', 'group5']));
+ ->willReturn(['group1', 'group2', 'group5']);
}
} else {
$this->config->expects($this->never())
@@ -460,22 +460,22 @@ public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $resul
}
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
+ $user2->method('getUID')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
+ $user3->method('getUID')->willReturn('user3');
$user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->will($this->returnValue('user4'));
+ $user4->method('getUID')->willReturn('user4');
if ($sharingEnabled) {
$this->userManager->expects($this->at(0))
->method('getByEmail')
->with('user@example.com')
- ->will($this->returnValue([$user2, $user3]));
+ ->willReturn([$user2, $user3]);
$this->userManager->expects($this->at(1))
->method('searchDisplayName')
->with('User 12')
- ->will($this->returnValue([$user3, $user4]));
+ ->willReturn([$user3, $user4]);
} else {
$this->userManager->expects($this->never())
->method('getByEmail');
@@ -488,19 +488,19 @@ public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $resul
$this->groupManager->expects($this->at(1))
->method('getUserGroupIds')
->with($user2)
- ->will($this->returnValue(['group1', 'group3']));
+ ->willReturn(['group1', 'group3']);
$this->groupManager->expects($this->at(2))
->method('getUserGroupIds')
->with($user3)
- ->will($this->returnValue(['group3', 'group4']));
+ ->willReturn(['group3', 'group4']);
$this->groupManager->expects($this->at(3))
->method('getUserGroupIds')
->with($user3)
- ->will($this->returnValue(['group3', 'group4']));
+ ->willReturn(['group3', 'group4']);
$this->groupManager->expects($this->at(4))
->method('getUserGroupIds')
->with($user4)
- ->will($this->returnValue(['group4', 'group5']));
+ ->willReturn(['group4', 'group5']);
}
@@ -523,7 +523,7 @@ public function searchPrincipalsDataProvider() {
public function testSearchPrincipalByCalendarUserAddressSet() {
$this->shareManager->expects($this->exactly(2))
->method('shareAPIEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->exactly(2))
->method('allowEnumeration')
@@ -531,17 +531,17 @@ public function testSearchPrincipalByCalendarUserAddressSet() {
$this->shareManager->expects($this->exactly(2))
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
+ $user2->method('getUID')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
+ $user3->method('getUID')->willReturn('user3');
$this->userManager->expects($this->at(0))
->method('getByEmail')
->with('user@example.com')
- ->will($this->returnValue([$user2, $user3]));
+ ->willReturn([$user2, $user3]);
$this->assertEquals([
'principals/users/user2',
@@ -553,7 +553,7 @@ public function testSearchPrincipalByCalendarUserAddressSet() {
public function testSearchPrincipalWithEnumerationDisabledDisplayname() {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->once())
->method('allowEnumeration')
@@ -561,25 +561,25 @@ public function testSearchPrincipalWithEnumerationDisabledDisplayname() {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
- $user2->method('getDisplayName')->will($this->returnValue('User 2'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar'));
+ $user2->method('getUID')->willReturn('user2');
+ $user2->method('getDisplayName')->willReturn('User 2');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
- $user2->method('getDisplayName')->will($this->returnValue('User 22'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar123'));
+ $user3->method('getUID')->willReturn('user3');
+ $user2->method('getDisplayName')->willReturn('User 22');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->will($this->returnValue('user4'));
- $user2->method('getDisplayName')->will($this->returnValue('User 222'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar456'));
+ $user4->method('getUID')->willReturn('user4');
+ $user2->method('getDisplayName')->willReturn('User 222');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar456');
$this->userManager->expects($this->at(0))
->method('searchDisplayName')
->with('User 2')
- ->will($this->returnValue([$user2, $user3, $user4]));
+ ->willReturn([$user2, $user3, $user4]);
$this->assertEquals(['principals/users/user2'], $this->connector->searchPrincipals('principals/users',
['{DAV:}displayname' => 'User 2']));
@@ -588,7 +588,7 @@ public function testSearchPrincipalWithEnumerationDisabledDisplayname() {
public function testSearchPrincipalWithEnumerationDisabledEmail() {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->once())
->method('allowEnumeration')
@@ -596,25 +596,25 @@ public function testSearchPrincipalWithEnumerationDisabledEmail() {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
- $user2->method('getDisplayName')->will($this->returnValue('User 2'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar'));
+ $user2->method('getUID')->willReturn('user2');
+ $user2->method('getDisplayName')->willReturn('User 2');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
- $user2->method('getDisplayName')->will($this->returnValue('User 22'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar123'));
+ $user3->method('getUID')->willReturn('user3');
+ $user2->method('getDisplayName')->willReturn('User 22');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->will($this->returnValue('user4'));
- $user2->method('getDisplayName')->will($this->returnValue('User 222'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar456'));
+ $user4->method('getUID')->willReturn('user4');
+ $user2->method('getDisplayName')->willReturn('User 222');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar456');
$this->userManager->expects($this->at(0))
->method('getByEmail')
->with('user2@foo.bar')
- ->will($this->returnValue([$user2, $user3, $user4]));
+ ->willReturn([$user2, $user3, $user4]);
$this->assertEquals(['principals/users/user2'], $this->connector->searchPrincipals('principals/users',
['{http://sabredav.org/ns}email-address' => 'user2@foo.bar']));
@@ -623,7 +623,7 @@ public function testSearchPrincipalWithEnumerationDisabledEmail() {
public function testSearchPrincipalWithEnumerationLimitedDisplayname() {
$this->shareManager->expects($this->at(0))
->method('shareAPIEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->at(1))
->method('allowEnumeration')
@@ -635,20 +635,20 @@ public function testSearchPrincipalWithEnumerationLimitedDisplayname() {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
- $user2->method('getDisplayName')->will($this->returnValue('User 2'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar'));
+ $user2->method('getUID')->willReturn('user2');
+ $user2->method('getDisplayName')->willReturn('User 2');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
- $user3->method('getDisplayName')->will($this->returnValue('User 22'));
- $user3->method('getEMailAddress')->will($this->returnValue('user2@foo.bar123'));
+ $user3->method('getUID')->willReturn('user3');
+ $user3->method('getDisplayName')->willReturn('User 22');
+ $user3->method('getEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->will($this->returnValue('user4'));
- $user4->method('getDisplayName')->will($this->returnValue('User 222'));
- $user4->method('getEMailAddress')->will($this->returnValue('user2@foo.bar456'));
+ $user4->method('getUID')->willReturn('user4');
+ $user4->method('getDisplayName')->willReturn('User 222');
+ $user4->method('getEMailAddress')->willReturn('user2@foo.bar456');
$this->userSession->expects($this->at(0))
@@ -684,7 +684,7 @@ public function testSearchPrincipalWithEnumerationLimitedDisplayname() {
public function testSearchPrincipalWithEnumerationLimitedMail() {
$this->shareManager->expects($this->at(0))
->method('shareAPIEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->at(1))
->method('allowEnumeration')
@@ -696,20 +696,20 @@ public function testSearchPrincipalWithEnumerationLimitedMail() {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
- $user2->method('getDisplayName')->will($this->returnValue('User 2'));
- $user2->method('getEMailAddress')->will($this->returnValue('user2@foo.bar'));
+ $user2->method('getUID')->willReturn('user2');
+ $user2->method('getDisplayName')->willReturn('User 2');
+ $user2->method('getEMailAddress')->willReturn('user2@foo.bar');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
- $user3->method('getDisplayName')->will($this->returnValue('User 22'));
- $user3->method('getEMailAddress')->will($this->returnValue('user2@foo.bar123'));
+ $user3->method('getUID')->willReturn('user3');
+ $user3->method('getDisplayName')->willReturn('User 22');
+ $user3->method('getEMailAddress')->willReturn('user2@foo.bar123');
$user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->will($this->returnValue('user4'));
- $user4->method('getDisplayName')->will($this->returnValue('User 222'));
- $user4->method('getEMailAddress')->will($this->returnValue('user2@foo.bar456'));
+ $user4->method('getUID')->willReturn('user4');
+ $user4->method('getDisplayName')->willReturn('User 222');
+ $user4->method('getEMailAddress')->willReturn('user2@foo.bar456');
$this->userSession->expects($this->at(0))
@@ -745,7 +745,7 @@ public function testSearchPrincipalWithEnumerationLimitedMail() {
public function testFindByUriSharingApiDisabled() {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertEquals(null, $this->connector->findByUri('mailto:user@foo.com', 'principals/users'));
}
@@ -756,42 +756,42 @@ public function testFindByUriSharingApiDisabled() {
public function testFindByUriWithGroupRestriction($uri, $email, $expects) {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->at(0))
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
+ $user2->method('getUID')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
+ $user3->method('getUID')->willReturn('user3');
$this->userManager->expects($this->once())
->method('getByEmail')
->with($email)
- ->will($this->returnValue([$email === 'user2@foo.bar' ? $user2 : $user3]));
+ ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]);
if ($email === 'user2@foo.bar') {
$this->groupManager->expects($this->at(1))
->method('getUserGroupIds')
->with($user2)
- ->will($this->returnValue(['group1', 'group3']));
+ ->willReturn(['group1', 'group3']);
} else {
$this->groupManager->expects($this->at(1))
->method('getUserGroupIds')
->with($user3)
- ->will($this->returnValue(['group3', 'group3']));
+ ->willReturn(['group3', 'group3']);
}
$this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users'));
@@ -810,21 +810,21 @@ public function findByUriWithGroupRestrictionDataProvider() {
public function testFindByUriWithoutGroupRestriction($uri, $email, $expects) {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('user2'));
+ $user2->method('getUID')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('user3'));
+ $user3->method('getUID')->willReturn('user3');
$this->userManager->expects($this->once())
->method('getByEmail')
->with($email)
- ->will($this->returnValue([$email === 'user2@foo.bar' ? $user2 : $user3]));
+ ->willReturn([$email === 'user2@foo.bar' ? $user2 : $user3]);
$this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users'));
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index 56ad3b36f73e2..50b3ff1c394df 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -184,11 +184,11 @@ public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) {
->getMock();
$mockChunking->expects($this->once())
->method('getCurrentSize')
- ->will($this->returnValue($chunkTotalSize));
+ ->willReturn($chunkTotalSize);
$this->plugin->expects($this->once())
->method('getFileChunking')
- ->will($this->returnValue($mockChunking));
+ ->willReturn($mockChunking);
$headers['OC-CHUNKED'] = 1;
$this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
@@ -221,11 +221,11 @@ public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
->getMock();
$mockChunking->expects($this->once())
->method('getCurrentSize')
- ->will($this->returnValue($chunkTotalSize));
+ ->willReturn($chunkTotalSize);
$this->plugin->expects($this->once())
->method('getFileChunking')
- ->will($this->returnValue($mockChunking));
+ ->willReturn($mockChunking);
$headers['OC-CHUNKED'] = 1;
$this->server->httpRequest = new \Sabre\HTTP\Request(null, null, $headers);
@@ -241,7 +241,7 @@ private function buildFileViewMock($quota, $checkedPath) {
$view->expects($this->any())
->method('free_space')
->with($this->identicalTo($checkedPath))
- ->will($this->returnValue($quota));
+ ->willReturn($quota);
return $view;
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
index 3aec6b9088a82..9771b3f76b438 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
@@ -42,13 +42,13 @@ protected function setUp(): void {
->getMock();
$mockConfig->expects($this->any())
->method('getSystemValue')
- ->will($this->returnCallback(function ($key, $default) use ($config) {
+ ->willReturnCallback(function ($key, $default) use ($config) {
if ($key === 'part_file_in_storage') {
return false;
} else {
return $config->getSystemValue($key, $default);
}
- }));
+ });
$this->overwriteService('AllConfig', $mockConfig);
parent::setUp();
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index a71cbb3ab6eda..c3566ccc33a0c 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -75,11 +75,11 @@ protected function setUp(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('user1'));
+ ->willReturn('user1');
$userSession = $this->createMock(IUserSession::class);
$userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->userFolder = $this->createMock(Folder::class);
$this->plugin = new \OCA\DAV\Connector\Sabre\SharesPlugin(
@@ -100,10 +100,10 @@ public function testGetProperties($shareTypes) {
->getMock();
$sabreNode->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$sabreNode->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/subdir'));
+ ->willReturn('/subdir');
// node API nodes
$node = $this->getMockBuilder(Folder::class)
@@ -113,7 +113,7 @@ public function testGetProperties($shareTypes) {
$this->userFolder->expects($this->once())
->method('get')
->with('/subdir')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->shareManager->expects($this->any())
->method('getSharesBy')
@@ -124,7 +124,7 @@ public function testGetProperties($shareTypes) {
$this->equalTo(false),
$this->equalTo(-1)
)
- ->will($this->returnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes){
+ ->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes){
if (in_array($requestedShareType, $shareTypes)) {
$share = $this->createMock(IShare::class);
$share->method('getShareType')
@@ -132,7 +132,7 @@ public function testGetProperties($shareTypes) {
return [$share];
}
return [];
- }));
+ });
$propFind = new \Sabre\DAV\PropFind(
'/dummyPath',
@@ -173,7 +173,7 @@ public function testPreloadThenGetProperties($shareTypes) {
->method('getChildren');
$sabreNode->expects($this->any())
->method('getPath')
- ->will($this->returnValue('/subdir'));
+ ->willReturn('/subdir');
// node API nodes
$node = $this->createMock(Folder::class);
@@ -194,7 +194,7 @@ public function testPreloadThenGetProperties($shareTypes) {
$share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())
->method('getShareType')
- ->will($this->returnValue($type));
+ ->willReturn($type);
return $share;
}, $shareTypes);
@@ -207,7 +207,7 @@ public function testPreloadThenGetProperties($shareTypes) {
$this->equalTo(false),
$this->equalTo(-1)
)
- ->will($this->returnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares){
+ ->willReturnCallback(function($userId, $requestedShareType, $node, $flag, $limit) use ($shareTypes, $dummyShares){
if ($node->getId() === 111 && in_array($requestedShareType, $shareTypes)) {
foreach ($dummyShares as $dummyShare) {
if ($dummyShare->getShareType() === $requestedShareType) {
@@ -217,7 +217,7 @@ public function testPreloadThenGetProperties($shareTypes) {
}
return [];
- }));
+ });
$this->shareManager->expects($this->any())
->method('getSharesInFolder')
@@ -226,9 +226,9 @@ public function testPreloadThenGetProperties($shareTypes) {
$this->anything(),
$this->equalTo(true)
)
- ->will($this->returnCallback(function ($userId, $node, $flag) use ($shareTypes, $dummyShares) {
+ ->willReturnCallback(function ($userId, $node, $flag) use ($shareTypes, $dummyShares) {
return [111 => $dummyShares];
- }));
+ });
// simulate sabre recursive PROPFIND traversal
$propFindRoot = new \Sabre\DAV\PropFind(
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index f417a27329a79..c1eaaae42c3ba 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -85,7 +85,7 @@ protected function setUp(): void {
$this->tagManager->expects($this->any())
->method('load')
->with('files')
- ->will($this->returnValue($this->tagger));
+ ->willReturn($this->tagger);
$this->plugin = new \OCA\DAV\Connector\Sabre\TagsPlugin($this->tree, $this->tagManager);
$this->plugin->initialize($this->server);
}
@@ -99,7 +99,7 @@ public function testGetProperties($tags, $requestedProperties, $expectedProperti
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$expectedCallCount = 0;
if (count($requestedProperties) > 0) {
@@ -109,7 +109,7 @@ public function testGetProperties($tags, $requestedProperties, $expectedProperti
$this->tagger->expects($this->exactly($expectedCallCount))
->method('getTagsForObjects')
->with($this->equalTo(array(123)))
- ->will($this->returnValue(array(123 => $tags)));
+ ->willReturn(array(123 => $tags));
$propFind = new \Sabre\DAV\PropFind(
'/dummyPath',
@@ -138,13 +138,13 @@ public function testPreloadThenGetProperties($tags, $requestedProperties, $expec
->getMock();
$node1->expects($this->any())
->method('getId')
- ->will($this->returnValue(111));
+ ->willReturn(111);
$node2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node2->expects($this->any())
->method('getId')
- ->will($this->returnValue(222));
+ ->willReturn(222);
$expectedCallCount = 0;
if (count($requestedProperties) > 0) {
@@ -159,20 +159,20 @@ public function testPreloadThenGetProperties($tags, $requestedProperties, $expec
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$node->expects($this->exactly($expectedCallCount))
->method('getChildren')
- ->will($this->returnValue(array($node1, $node2)));
+ ->willReturn(array($node1, $node2));
$this->tagger->expects($this->exactly($expectedCallCount))
->method('getTagsForObjects')
->with($this->equalTo(array(123, 111, 222)))
- ->will($this->returnValue(
+ ->willReturn(
array(
111 => $tags,
123 => $tags
)
- ));
+ );
// simulate sabre recursive PROPFIND traversal
$propFindRoot = new \Sabre\DAV\PropFind(
@@ -274,17 +274,17 @@ public function testUpdateTags() {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->tagger->expects($this->at(0))
->method('getTagsForObjects')
->with($this->equalTo(array(123)))
- ->will($this->returnValue(array(123 => array('tagkeep', 'tagremove', self::TAG_FAVORITE))));
+ ->willReturn(array(123 => array('tagkeep', 'tagremove', self::TAG_FAVORITE)));
// then tag as tag1 and tag2
$this->tagger->expects($this->at(1))
@@ -325,17 +325,17 @@ public function testUpdateTagsFromScratch() {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->tagger->expects($this->at(0))
->method('getTagsForObjects')
->with($this->equalTo(array(123)))
- ->will($this->returnValue(array()));
+ ->willReturn(array());
// then tag as tag1 and tag2
$this->tagger->expects($this->at(1))
@@ -373,12 +373,12 @@ public function testUpdateFav() {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
- ->will($this->returnValue($node));
+ ->willReturn($node);
// set favorite tag
$this->tagger->expects($this->once())
diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
index e847e3a036eb1..bfb789678b7ac 100644
--- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
+++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
@@ -81,18 +81,18 @@ public function testEnable() {
$this->userManager->expects($this->once())
->method('callForSeenUsers')
- ->will($this->returnCallback(function($closure) {
+ ->willReturnCallback(function($closure) {
$user1 = $this->createMock(IUser::class);
- $user1->method('getUID')->will($this->returnValue('uid1'));
+ $user1->method('getUID')->willReturn('uid1');
$user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->will($this->returnValue('uid2'));
+ $user2->method('getUID')->willReturn('uid2');
$user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->will($this->returnValue('uid3'));
+ $user3->method('getUID')->willReturn('uid3');
$closure($user1);
$closure($user2);
$closure($user3);
- }));
+ });
$this->jobList->expects($this->at(0))
->method('add')
diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
index 811c4cac2838d..1c29ca7d80b03 100644
--- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
+++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
@@ -108,7 +108,7 @@ public function testAccept() {
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->will($this->returnCallback(function(Message $iTipMessage) use (&$called, $expected) {
+ ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
@@ -120,7 +120,7 @@ public function testAccept() {
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -164,7 +164,7 @@ public function testAcceptSequence() {
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->will($this->returnCallback(function(Message $iTipMessage) use (&$called, $expected) {
+ ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
@@ -176,7 +176,7 @@ public function testAcceptSequence() {
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -221,7 +221,7 @@ public function testAcceptRecurrenceId() {
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->will($this->returnCallback(function(Message $iTipMessage) use (&$called, $expected) {
+ ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
@@ -233,7 +233,7 @@ public function testAcceptRecurrenceId() {
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -304,7 +304,7 @@ public function testDecline() {
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->will($this->returnCallback(function(Message $iTipMessage) use (&$called, $expected) {
+ ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
@@ -316,7 +316,7 @@ public function testDecline() {
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -338,15 +338,15 @@ public function testProcessMoreOptionsResult() {
$this->request->expects($this->at(0))
->method('getParam')
->with('partStat')
- ->will($this->returnValue('TENTATIVE'));
+ ->willReturn('TENTATIVE');
$this->request->expects($this->at(1))
->method('getParam')
->with('guests')
- ->will($this->returnValue('7'));
+ ->willReturn('7');
$this->request->expects($this->at(2))
->method('getParam')
->with('comment')
- ->will($this->returnValue('Foo bar Bli blub'));
+ ->willReturn('Foo bar Bli blub');
$this->buildQueryExpects('TOKEN123', [
'id' => 0,
@@ -382,7 +382,7 @@ public function testProcessMoreOptionsResult() {
$called = false;
$this->responseServer->expects($this->once())
->method('handleITipMessage')
- ->will($this->returnCallback(function(Message $iTipMessage) use (&$called, $expected) {
+ ->willReturnCallback(function(Message $iTipMessage) use (&$called, $expected) {
$called = true;
$this->assertEquals('this-is-the-events-uid', $iTipMessage->uid);
$this->assertEquals('VEVENT', $iTipMessage->component);
@@ -394,7 +394,7 @@ public function testProcessMoreOptionsResult() {
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -413,47 +413,47 @@ private function buildQueryExpects($token, $return, $time) {
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')
->with()
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->method('expr')
- ->will($this->returnValue($expr));
+ ->willReturn($expr);
$queryBuilder->method('createNamedParameter')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[$token, \PDO::PARAM_STR, null, 'namedParameterToken']
- ]));
+ ]);
$stmt->expects($this->once())
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->will($this->returnValue($return));
+ ->willReturn($return);
$expr->expects($this->once())
->method('eq')
->with('token', 'namedParameterToken')
- ->will($this->returnValue('EQ STATEMENT'));
+ ->willReturn('EQ STATEMENT');
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')
->with()
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(0))
->method('select')
->with('*')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(1))
->method('from')
->with('calendar_invitations')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(4))
->method('where')
->with('EQ STATEMENT')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(5))
->method('execute')
->with()
- ->will($this->returnValue($stmt));
+ ->willReturn($stmt);
$this->timeFactory->method('getTime')
- ->will($this->returnValue($time));
+ ->willReturn($time);
}
}
diff --git a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
index 45aab9af1f562..28af0715ea118 100644
--- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
@@ -59,7 +59,7 @@ protected function setUp(): void {
$this->user = $this->createMock(IUser::class);
$this->user->method('getUID')
->with()
- ->will($this->returnValue('dummy_user_42'));
+ ->willReturn('dummy_user_42');
$this->dbConnection = \OC::$server->getDatabaseConnection();
$this->backend = new CustomPropertiesBackend(
@@ -125,12 +125,12 @@ public function testPropFindNoDbCalls() {
$propFind->expects($this->at(0))
->method('get404Properties')
->with()
- ->will($this->returnValue([
+ ->willReturn([
'{http://owncloud.org/ns}permissions',
'{http://owncloud.org/ns}downloadURL',
'{http://owncloud.org/ns}dDC',
'{http://owncloud.org/ns}size',
- ]));
+ ]);
$db->expects($this->never())
->method($this->anything());
@@ -142,16 +142,16 @@ public function testPropFindCalendarCall() {
$propFind = $this->createMock(PropFind::class);
$propFind->method('get404Properties')
->with()
- ->will($this->returnValue([
+ ->willReturn([
'{DAV:}getcontentlength',
'{DAV:}getcontenttype',
'{DAV:}getetag',
'{abc}def',
- ]));
+ ]);
$propFind->method('getRequestedProperties')
->with()
- ->will($this->returnValue([
+ ->willReturn([
'{DAV:}getcontentlength',
'{DAV:}getcontenttype',
'{DAV:}getetag',
@@ -159,7 +159,7 @@ public function testPropFindCalendarCall() {
'{urn:ietf:params:xml:ns:caldav}calendar-description',
'{urn:ietf:params:xml:ns:caldav}calendar-timezone',
'{abc}def',
- ]));
+ ]);
$props = [
'{abc}def' => 'a',
diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php
index e60c261930395..08239dfd46aca 100644
--- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php
+++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php
@@ -74,7 +74,7 @@ public function testGetPrincipalsByPrefixWithUsers() {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([$group1, $group2]));
+ ->willReturn([$group1, $group2]);
$expectedResponse = [
0 => [
@@ -97,7 +97,7 @@ public function testGetPrincipalsByPrefixEmpty() {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->connector->getPrincipalsByPrefix('principals/groups');
$this->assertSame([], $response);
@@ -109,7 +109,7 @@ public function testGetPrincipalsByPathWithoutMail() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($group1));
+ ->willReturn($group1);
$expectedResponse = [
'uri' => 'principals/groups/foo',
@@ -126,7 +126,7 @@ public function testGetPrincipalsByPathWithMail() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$expectedResponse = [
'uri' => 'principals/groups/foo',
@@ -142,7 +142,7 @@ public function testGetPrincipalsByPathEmpty() {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$response = $this->connector->getPrincipalByPath('principals/groups/foo');
$this->assertSame(null, $response);
@@ -154,7 +154,7 @@ public function testGetPrincipalsByPathGroupWithSlash() {
->expects($this->once())
->method('get')
->with('foo/bar')
- ->will($this->returnValue($group1));
+ ->willReturn($group1);
$expectedResponse = [
'uri' => 'principals/groups/foo%2Fbar',
@@ -202,23 +202,23 @@ public function testSearchPrincipalsWithWrongPrefixPath() {
public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $result) {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
- ->will($this->returnValue($sharingEnabled));
+ ->willReturn($sharingEnabled);
if ($sharingEnabled) {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue($groupsOnly));
+ ->willReturn($groupsOnly);
if ($groupsOnly) {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2', 'group5']));
+ ->willReturn(['group1', 'group2', 'group5']);
}
} else {
$this->shareManager->expects($this->never())
@@ -228,21 +228,21 @@ public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $resul
}
$group1 = $this->createMock(IGroup::class);
- $group1->method('getGID')->will($this->returnValue('group1'));
+ $group1->method('getGID')->willReturn('group1');
$group2 = $this->createMock(IGroup::class);
- $group2->method('getGID')->will($this->returnValue('group2'));
+ $group2->method('getGID')->willReturn('group2');
$group3 = $this->createMock(IGroup::class);
- $group3->method('getGID')->will($this->returnValue('group3'));
+ $group3->method('getGID')->willReturn('group3');
$group4 = $this->createMock(IGroup::class);
- $group4->method('getGID')->will($this->returnValue('group4'));
+ $group4->method('getGID')->willReturn('group4');
$group5 = $this->createMock(IGroup::class);
- $group5->method('getGID')->will($this->returnValue('group5'));
+ $group5->method('getGID')->willReturn('group5');
if ($sharingEnabled) {
$this->groupManager->expects($this->once())
->method('search')
->with('Foo')
- ->will($this->returnValue([$group1, $group2, $group3, $group4, $group5]));
+ ->willReturn([$group1, $group2, $group3, $group4, $group5]);
} else {
$this->groupManager->expects($this->never())
->method('search');
@@ -269,23 +269,23 @@ public function searchPrincipalsDataProvider() {
public function testFindByUri($sharingEnabled, $groupsOnly, $findUri, $result) {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
- ->will($this->returnValue($sharingEnabled));
+ ->willReturn($sharingEnabled);
if ($sharingEnabled) {
$this->shareManager->expects($this->once())
->method('shareWithGroupMembersOnly')
- ->will($this->returnValue($groupsOnly));
+ ->willReturn($groupsOnly);
if ($groupsOnly) {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->at(0))
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(['group1', 'group2', 'group5']));
+ ->willReturn(['group1', 'group2', 'group5']);
}
} else {
$this->shareManager->expects($this->never())
diff --git a/apps/dav/tests/unit/DAV/HookManagerTest.php b/apps/dav/tests/unit/DAV/HookManagerTest.php
index ab95008585b74..7b3388b9e74c6 100644
--- a/apps/dav/tests/unit/DAV/HookManagerTest.php
+++ b/apps/dav/tests/unit/DAV/HookManagerTest.php
@@ -54,9 +54,9 @@ protected function setUp(): void {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
}
public function test() {
diff --git a/apps/dav/tests/unit/Files/FileSearchBackendTest.php b/apps/dav/tests/unit/Files/FileSearchBackendTest.php
index 2f8dec6248074..167b68e076c20 100644
--- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php
+++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php
@@ -133,9 +133,9 @@ public function testSearchFilename() {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, '{DAV:}displayname', 'foo');
$result = $this->search->search($query);
@@ -162,9 +162,9 @@ public function testSearchMimetype() {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, '{DAV:}getcontenttype', 'foo');
$result = $this->search->search($query);
@@ -191,9 +191,9 @@ public function testSearchSize() {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, FilesPlugin::SIZE_PROPERTYNAME, 10);
$result = $this->search->search($query);
@@ -220,9 +220,9 @@ public function testSearchMtime() {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, '{DAV:}getlastmodified', 10);
$result = $this->search->search($query);
@@ -249,9 +249,9 @@ public function testSearchIsCollection() {
[],
$this->user
))
- ->will($this->returnValue([
+ ->willReturn([
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
- ]));
+ ]);
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_IS_COLLECTION, 'yes');
$result = $this->search->search($query);
@@ -320,12 +320,12 @@ public function testSearchLimitOwnerBasic() {
$receivedQuery = null;
$this->searchFolder
->method('search')
- ->will($this->returnCallback(function ($query) use (&$receivedQuery) {
+ ->willReturnCallback(function ($query) use (&$receivedQuery) {
$receivedQuery = $query;
return [
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
];
- }));
+ });
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, FilesPlugin::OWNER_ID_PROPERTYNAME, $this->user->getUID());
$this->search->search($query);
@@ -349,12 +349,12 @@ public function testSearchLimitOwnerNested() {
$receivedQuery = null;
$this->searchFolder
->method('search')
- ->will($this->returnCallback(function ($query) use (&$receivedQuery) {
+ ->willReturnCallback(function ($query) use (&$receivedQuery) {
$receivedQuery = $query;
return [
new \OC\Files\Node\Folder($this->rootFolder, $this->view, '/test/path')
];
- }));
+ });
$query = $this->getBasicQuery(\SearchDAV\Query\Operator::OPERATION_EQUAL, FilesPlugin::OWNER_ID_PROPERTYNAME, $this->user->getUID());
$query->where = new \SearchDAV\Query\Operator(
diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
index 852a22564c3e9..77646b2c9d1a4 100644
--- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
+++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
@@ -122,13 +122,13 @@ public function testFileAlreadyExistsValid() {
->willReturn('https://example.com');
$this->view->method('file_exists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'file.txt' || $path === '/file.txt') {
return true;
} else {
return false;
}
- }));
+ });
$this->request->expects($this->once())
->method('setUrl')
@@ -163,13 +163,13 @@ public function testNoSubdirPut() {
->willReturn('https://example.com');
$this->view->method('file_exists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'file.txt' || $path === '/file.txt') {
return true;
} else {
return false;
}
- }));
+ });
$this->request->expects($this->once())
->method('setUrl')
diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
index ad56a0dd71530..dc6c64f2abba4 100644
--- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
+++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
@@ -64,45 +64,45 @@ public function testRun() {
$this->db->expects($this->once())
->method('getQueryBuilder')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(0))
->method('select')
->with(['principaluri', 'uri'])
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(1))
->method('from')
->with('calendarsubscriptions')
- ->will($this->returnValue($queryBuilder));
+ ->willReturn($queryBuilder);
$queryBuilder->expects($this->at(2))
->method('execute')
- ->will($this->returnValue($statement));
+ ->willReturn($statement);
$statement->expects($this->at(0))
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->will($this->returnValue([
+ ->willReturn([
'principaluri' => 'foo1',
'uri' => 'bar1',
- ]));
+ ]);
$statement->expects($this->at(1))
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->will($this->returnValue([
+ ->willReturn([
'principaluri' => 'foo2',
'uri' => 'bar2',
- ]));
+ ]);
$statement->expects($this->at(2))
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->will($this->returnValue([
+ ->willReturn([
'principaluri' => 'foo3',
'uri' => 'bar3',
- ]));
+ ]);
$statement->expects($this->at(0))
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->jobList->expects($this->at(0))
->method('has')
@@ -110,7 +110,7 @@ public function testRun() {
'principaluri' => 'foo1',
'uri' => 'bar1',
])
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->jobList->expects($this->at(1))
->method('add')
->with(RefreshWebcalJob::class, [
@@ -123,14 +123,14 @@ public function testRun() {
'principaluri' => 'foo2',
'uri' => 'bar2',
])
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->jobList->expects($this->at(3))
->method('has')
->with(RefreshWebcalJob::class, [
'principaluri' => 'foo3',
'uri' => 'bar3',
])
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->jobList->expects($this->at(4))
->method('add')
->with(RefreshWebcalJob::class, [
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
index 5dac83c5d9666..8e6cd85817ba9 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -88,11 +88,11 @@ public function testDeleteTag() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($node->getSystemTag())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('canUserAssignTag')
->with($node->getSystemTag())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->never())
->method('deleteTags');
$this->tagMapper->expects($this->once())
@@ -124,11 +124,11 @@ public function testDeleteTagExpectedException(ISystemTag $tag, $expectedExcepti
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($tag->isUserVisible()));
+ ->willReturn($tag->isUserVisible());
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue($tag->isUserAssignable()));
+ ->willReturn($tag->isUserAssignable());
$this->tagManager->expects($this->never())
->method('deleteTags');
$this->tagMapper->expects($this->never())
@@ -154,11 +154,11 @@ public function testDeleteTagNotFound() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($tag->isUserVisible()));
+ ->willReturn($tag->isUserVisible());
$this->tagManager->expects($this->once())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue($tag->isUserAssignable()));
+ ->willReturn($tag->isUserAssignable());
$this->tagMapper->expects($this->once())
->method('unassignTags')
->with(123, 'files', 1)
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
index bf3818309fada..b8f45fdae3c1b 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -118,11 +118,11 @@ public function testUpdateTag($isAdmin, ISystemTag $originalTag, $changedArgs) {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($originalTag)
- ->will($this->returnValue($originalTag->isUserVisible() || $isAdmin));
+ ->willReturn($originalTag->isUserVisible() || $isAdmin);
$this->tagManager->expects($this->once())
->method('canUserAssignTag')
->with($originalTag)
- ->will($this->returnValue($originalTag->isUserAssignable() || $isAdmin));
+ ->willReturn($originalTag->isUserAssignable() || $isAdmin);
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, $changedArgs[0], $changedArgs[1], $changedArgs[2]);
@@ -178,11 +178,11 @@ public function testUpdateTagPermissionException(ISystemTag $originalTag, $chang
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($originalTag)
- ->will($this->returnValue($originalTag->isUserVisible()));
+ ->willReturn($originalTag->isUserVisible());
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
->with($originalTag)
- ->will($this->returnValue($originalTag->isUserAssignable()));
+ ->willReturn($originalTag->isUserAssignable());
$this->tagManager->expects($this->never())
->method('updateTag');
@@ -206,11 +206,11 @@ public function testUpdateTagAlreadyExists() {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, 'Renamed', true, true)
@@ -226,11 +226,11 @@ public function testUpdateTagNotFound() {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('updateTag')
->with(1, 'Renamed', true, true)
@@ -246,7 +246,7 @@ public function testDeleteTag($isAdmin) {
$this->tagManager->expects($isAdmin ? $this->once() : $this->never())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($isAdmin ? $this->once() : $this->never())
->method('deleteTags')
->with('1');
@@ -278,7 +278,7 @@ public function testDeleteTagPermissionException(ISystemTag $tag, $expectedExcep
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($tag->isUserVisible()));
+ ->willReturn($tag->isUserVisible());
$this->tagManager->expects($this->never())
->method('deleteTags');
@@ -294,7 +294,7 @@ public function testDeleteTagNotFound() {
$this->tagManager->expects($this->any())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($tag->isUserVisible()));
+ ->willReturn($tag->isUserVisible());
$this->tagManager->expects($this->once())
->method('deleteTags')
->with('1')
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
index 93f9a4f4e225d..f634c71709301 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -202,20 +202,20 @@ public function testGetProperties(ISystemTag $systemTag, $groups, $requestedProp
->getMock();
$node->expects($this->any())
->method('getSystemTag')
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
- ->will($this->returnValue($systemTag->isUserAssignable()));
+ ->willReturn($systemTag->isUserAssignable());
$this->tagManager->expects($this->any())
->method('getTagGroups')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtag/1')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$propFind = new \Sabre\DAV\PropFind(
'/systemtag/1',
@@ -257,12 +257,12 @@ public function testGetPropertiesForbidden() {
->getMock();
$node->expects($this->any())
->method('getSystemTag')
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtag/1')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$propFind = new \Sabre\DAV\PropFind(
'/systemtag/1',
@@ -292,12 +292,12 @@ public function testUpdatePropertiesAdmin() {
->getMock();
$node->expects($this->any())
->method('getSystemTag')
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtag/1')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$node->expects($this->once())
->method('update')
@@ -350,12 +350,12 @@ public function testUpdatePropertiesForbidden() {
->getMock();
$node->expects($this->any())
->method('getSystemTag')
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtag/1')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$node->expects($this->never())
->method('update');
@@ -420,7 +420,7 @@ public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssig
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtags')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -431,16 +431,16 @@ public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssig
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags'));
+ ->willReturn('/systemtags');
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$this->plugin->httpPost($request, $response);
}
@@ -460,12 +460,12 @@ public function testCreateTagInByIdCollectionAsRegularUser() {
$this->tagManager->expects($this->once())
->method('createTag')
->with('Test', true, true)
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtags')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -476,20 +476,20 @@ public function testCreateTagInByIdCollectionAsRegularUser() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags'));
+ ->willReturn('/systemtags');
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->once())
->method('getUrl')
- ->will($this->returnValue('http://example.com/dav/systemtags'));
+ ->willReturn('http://example.com/dav/systemtags');
$response->expects($this->once())
->method('setHeader')
@@ -537,13 +537,13 @@ public function testCreateTagInByIdCollection($userVisible, $userAssignable, $gr
$this->tagManager->expects($this->once())
->method('createTag')
->with('Test', $userVisible, $userAssignable)
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
if (!empty($groups)) {
$this->tagManager->expects($this->once())
->method('setTagGroups')
->with($systemTag, explode('|', $groups))
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
} else {
$this->tagManager->expects($this->never())
->method('setTagGroups');
@@ -552,7 +552,7 @@ public function testCreateTagInByIdCollection($userVisible, $userAssignable, $gr
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtags')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -563,20 +563,20 @@ public function testCreateTagInByIdCollection($userVisible, $userAssignable, $gr
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags'));
+ ->willReturn('/systemtags');
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->once())
->method('getUrl')
- ->will($this->returnValue('http://example.com/dav/systemtags'));
+ ->willReturn('http://example.com/dav/systemtags');
$response->expects($this->once())
->method('setHeader')
@@ -617,12 +617,12 @@ public function testCreateTagInMappingCollection() {
$this->tagManager->expects($this->once())
->method('createTag')
->with('Test', true, false)
- ->will($this->returnValue($systemTag));
+ ->willReturn($systemTag);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtags-relations/files/12')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$node->expects($this->once())
->method('createFile')
@@ -637,20 +637,20 @@ public function testCreateTagInMappingCollection() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags-relations/files/12'));
+ ->willReturn('/systemtags-relations/files/12');
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$request->expects($this->once())
->method('getBaseUrl')
- ->will($this->returnValue('http://example.com/dav/'));
+ ->willReturn('http://example.com/dav/');
$response->expects($this->once())
->method('setHeader')
@@ -686,7 +686,7 @@ public function testCreateTagToUnknownNode() {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags-relations/files/12'));
+ ->willReturn('/systemtags-relations/files/12');
$this->plugin->httpPost($request, $response);
}
@@ -723,7 +723,7 @@ public function testCreateTagConflict($nodeClass) {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/systemtags')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
@@ -734,16 +734,16 @@ public function testCreateTagConflict($nodeClass) {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/systemtags'));
+ ->willReturn('/systemtags');
$request->expects($this->once())
->method('getBodyAsString')
- ->will($this->returnValue($requestData));
+ ->willReturn($requestData);
$request->expects($this->once())
->method('getHeader')
->with('Content-Type')
- ->will($this->returnValue('application/json'));
+ ->willReturn('application/json');
$this->plugin->httpPost($request, $response);
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
index c7e3a4a914652..1761622708891 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -57,18 +57,18 @@ public function getNode($isAdmin = true) {
->getMock();
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('testuser'));
+ ->willReturn('testuser');
$userSession = $this->getMockBuilder(IUserSession::class)
->getMock();
$userSession->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock();
$groupManager->expects($this->any())
->method('isAdmin')
->with('testuser')
- ->will($this->returnValue($isAdmin));
+ ->willReturn($isAdmin);
return new \OCA\DAV\SystemTag\SystemTagsByIdCollection(
$this->tagManager,
$userSession,
@@ -99,12 +99,12 @@ public function testGetChild() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$childNode = $this->getNode()->getChild('123');
@@ -146,7 +146,7 @@ public function testGetChildUserNotVisible() {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->getNode(false)->getChild('123');
}
@@ -158,7 +158,7 @@ public function testGetChildrenAdmin() {
$this->tagManager->expects($this->once())
->method('getAllTags')
->with(null)
- ->will($this->returnValue([$tag1, $tag2]));
+ ->willReturn([$tag1, $tag2]);
$children = $this->getNode(true)->getChildren();
@@ -177,7 +177,7 @@ public function testGetChildrenNonAdmin() {
$this->tagManager->expects($this->once())
->method('getAllTags')
->with(true)
- ->will($this->returnValue([$tag1, $tag2]));
+ ->willReturn([$tag1, $tag2]);
$children = $this->getNode(false)->getChildren();
@@ -193,7 +193,7 @@ public function testGetChildrenEmpty() {
$this->tagManager->expects($this->once())
->method('getAllTags')
->with(null)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertCount(0, $this->getNode()->getChildren());
}
@@ -212,12 +212,12 @@ public function testChildExists($userVisible, $expectedResult) {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($userVisible));
+ ->willReturn($userVisible);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->assertEquals($expectedResult, $this->getNode()->childExists('123'));
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
index 58de0dd54abac..b28590a596247 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -76,16 +76,16 @@ public function testAssignTag() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->tagMapper->expects($this->once())
->method('assignTags')
->with(111, 'files', '555');
@@ -110,16 +110,16 @@ public function testAssignTagNoPermission($userVisible, $userAssignable, $expect
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue($userVisible));
+ ->willReturn($userVisible);
$this->tagManager->expects($this->any())
->method('canUserAssignTag')
->with($tag)
- ->will($this->returnValue($userAssignable));
+ ->willReturn($userAssignable);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->tagMapper->expects($this->never())
->method('assignTags');
@@ -157,17 +157,17 @@ public function testGetChild() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue(['555' => $tag]));
+ ->willReturn(['555' => $tag]);
$childNode = $this->getNode()->getChild('555');
@@ -183,17 +183,17 @@ public function testGetChildNonVisible() {
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue(['555' => $tag]));
+ ->willReturn(['555' => $tag]);
$this->getNode()->getChild('555');
}
@@ -205,7 +205,7 @@ public function testGetChildRelationNotFound() {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '777')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->getNode()->getChild('777');
}
@@ -242,18 +242,18 @@ public function testGetChildren() {
$this->tagMapper->expects($this->once())
->method('getTagIdsForObjects')
->with([111], 'files')
- ->will($this->returnValue(['111' => ['555', '556', '557']]));
+ ->willReturn(['111' => ['555', '556', '557']]);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555', '556', '557'])
- ->will($this->returnValue(['555' => $tag1, '556' => $tag2, '557' => $tag3]));
+ ->willReturn(['555' => $tag1, '556' => $tag2, '557' => $tag3]);
$this->tagManager->expects($this->exactly(3))
->method('canUserSeeTag')
- ->will($this->returnCallback(function($tag) {
+ ->willReturnCallback(function($tag) {
return $tag->isUserVisible();
- }));
+ });
$children = $this->getNode()->getChildren();
@@ -277,17 +277,17 @@ public function testChildExistsWithVisibleTag() {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('canUserSeeTag')
->with($tag)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->assertTrue($this->getNode()->childExists('555'));
}
@@ -298,12 +298,12 @@ public function testChildExistsWithInvisibleTag() {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['555'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->assertFalse($this->getNode()->childExists('555'));
}
@@ -312,7 +312,7 @@ public function testChildExistsNotFound() {
$this->tagMapper->expects($this->once())
->method('haveTag')
->with([111], 'files', '555')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->getNode()->childExists('555'));
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
index 7854360e0fd11..0a98cfdc4e05b 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -66,18 +66,18 @@ protected function setUp(): void {
->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('testuser'));
+ ->willReturn('testuser');
$userSession = $this->getMockBuilder(IUserSession::class)
->getMock();
$userSession->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock();
$groupManager->expects($this->any())
->method('isAdmin')
->with('testuser')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userFolder = $this->getMockBuilder(Folder::class)
->getMock();
@@ -116,7 +116,7 @@ public function testGetChild() {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
- ->will($this->returnValue([true]));
+ ->willReturn([true]);
$childNode = $this->node->getChild('555');
$this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection', $childNode);
@@ -130,7 +130,7 @@ public function testGetChildWithoutAccess() {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->node->getChild('555');
}
@@ -145,7 +145,7 @@ public function testChildExists() {
$this->userFolder->expects($this->once())
->method('getById')
->with('123')
- ->will($this->returnValue([true]));
+ ->willReturn([true]);
$this->assertTrue($this->node->childExists('123'));
}
@@ -153,7 +153,7 @@ public function testChildExistsWithoutAccess() {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertFalse($this->node->childExists('555'));
}
diff --git a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php
index d0eeed786781e..d338c5b31f1ce 100644
--- a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php
+++ b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php
@@ -80,7 +80,7 @@ public function testBeforeMoveFutureFileSkip() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('source')
- ->will($this->returnValue($node));
+ ->willReturn($node);
$this->response->expects($this->never())
->method('setStatus');
@@ -96,11 +96,11 @@ public function testBeforeMoveFutureFileSkipNonExisting() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('source')
- ->will($this->returnValue($sourceNode));
+ ->willReturn($sourceNode);
$this->tree->expects($this->any())
->method('nodeExists')
->with('target')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->response->expects($this->never())
->method('setStatus');
$this->request->expects($this->once())
@@ -120,11 +120,11 @@ public function testBeforeMoveFutureFileMoveIt() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('source')
- ->will($this->returnValue($sourceNode));
+ ->willReturn($sourceNode);
$this->tree->expects($this->any())
->method('nodeExists')
->with('target')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tree->expects($this->once())
->method('move')
->with('source', 'target');
@@ -156,7 +156,7 @@ public function testBeforeMoveSizeIsWrong() {
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('source')
- ->will($this->returnValue($sourceNode));
+ ->willReturn($sourceNode);
$this->request->expects($this->once())
->method('getHeader')
->with('OC-Total-Length')
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index e3614b918c35a..c6f7a8649b6cc 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -108,10 +108,10 @@ public function testChangeRecoveryPassword($password, $confirmPassword, $oldPass
$this->recoveryMock->expects($this->any())
->method('changeRecoveryKeyPassword')
->with($password, $oldPassword)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['test', 'oldTestFail', false],
['test', 'oldtest', true]
- ]));
+ ]);
$response = $this->controller->changeRecoveryPassword($password,
$oldPassword,
@@ -140,10 +140,10 @@ public function testUserSetRecovery($enableRecovery, $expectedMessage, $expected
$this->recoveryMock->expects($this->any())
->method('setRecoveryForUser')
->with($enableRecovery)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['1', true],
['0', false]
- ]));
+ ]);
$response = $this->controller->userSetRecovery($enableRecovery);
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 62c5ebf608c50..c2f67478bb7d2 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -85,9 +85,9 @@ protected function setUp(): void {
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($message) {
+ ->willReturnCallback(function($message) {
return $message;
- }));
+ });
$this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index 8e217bfa473e6..f93be963989ac 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -63,9 +63,9 @@ protected function setUp(): void {
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($message) {
+ ->willReturnCallback(function($message) {
return $message;
- }));
+ });
$this->encryptionManagerMock = $this->createMock(IManager::class);
$this->controller = new StatusController('encryptionTest',
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 7b563c06c02c8..9a541880e7909 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -151,10 +151,10 @@ public function endTest() {
$this->keyManagerMock->expects($this->any())
->method('getPublicKey')
- ->will($this->returnCallback([$this, 'getPublicKeyCallback']));
+ ->willReturnCallback([$this, 'getPublicKeyCallback']);
$this->keyManagerMock->expects($this->any())
->method('addSystemKeys')
- ->will($this->returnCallback([$this, 'addSystemKeysCallback']));
+ ->willReturnCallback([$this, 'addSystemKeysCallback']);
$this->cryptMock->expects($this->any())
->method('multiKeyEncrypt')
->willReturn(true);
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index 4d35d54631760..53548c7ccd8ad 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -307,7 +307,7 @@ public function XtestSetPasswordNoUser() {
->disableOriginalConstructor()
->getMock();
- $userSessionMock->expects($this->any())->method('getUser')->will($this->returnValue(null));
+ $userSessionMock->expects($this->any())->method('getUser')->willReturn(null);
$this->recoveryMock->expects($this->once())
->method('isRecoveryEnabledForUser')
diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php
index a76d5f7d5627b..9dbc818af3a59 100644
--- a/apps/encryption/tests/RecoveryTest.php
+++ b/apps/encryption/tests/RecoveryTest.php
@@ -168,7 +168,7 @@ public function testChangeRecoveryKeyPasswordCouldNotDecryptPrivateRecoveryKey()
$this->cryptMock->expects($this->once())
->method('decryptPrivateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld'));
}
@@ -283,11 +283,11 @@ protected function setUp(): void {
$this->configMock->expects($this->any())
->method('setAppValue')
- ->will($this->returnCallback([$this, 'setValueTester']));
+ ->willReturnCallback([$this, 'setValueTester']);
$this->configMock->expects($this->any())
->method('getAppValue')
- ->will($this->returnCallback([$this, 'getValueTester']));
+ ->willReturnCallback([$this, 'getValueTester']);
$this->instance = new Recovery($this->userSessionMock,
$this->cryptMock,
diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php
index 21de1ee971c62..daa05b140da24 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -204,15 +204,15 @@ protected function setUp(): void {
$this->sessionMock->expects($this->any())
->method('set')
- ->will($this->returnCallback([$this, "setValueTester"]));
+ ->willReturnCallback([$this, "setValueTester"]);
$this->sessionMock->expects($this->any())
->method('get')
- ->will($this->returnCallback([$this, "getValueTester"]));
+ ->willReturnCallback([$this, "getValueTester"]);
$this->sessionMock->expects($this->any())
->method('remove')
- ->will($this->returnCallback([$this, "removeValueTester"]));
+ ->willReturnCallback([$this, "removeValueTester"]);
$this->instance = new Session($this->sessionMock);
diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php
index cade0b2f823c4..e9133055f418d 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -75,7 +75,7 @@ public function testIsRecoveryEnabledForUser() {
public function testUserHasFiles() {
$this->filesMock->expects($this->once())
->method('file_exists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($this->instance->userHasFiles('admin'));
}
@@ -111,11 +111,11 @@ protected function setUp(): void {
$this->configMock->expects($this->any())
->method('getUserValue')
- ->will($this->returnCallback([$this, 'getValueTester']));
+ ->willReturnCallback([$this, 'getValueTester']);
$this->configMock->expects($this->any())
->method('setUserValue')
- ->will($this->returnCallback([$this, 'setValueTester']));
+ ->willReturnCallback([$this, 'setValueTester']);
$this->instance = new Util($this->filesMock, $cryptMock, $loggerMock, $userSessionMock, $this->configMock, $this->userManagerMock);
}
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
index c8acdd3df53d7..ecac809d43407 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -97,9 +97,9 @@ protected function setUp(): void {
->getMock();
$this->l = $this->getMockBuilder(IL10N::class)->getMock();
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php
index 82f69df3ddc56..5686fbc749c9f 100644
--- a/apps/files/tests/BackgroundJob/ScanFilesTest.php
+++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php
@@ -63,22 +63,22 @@ public function testRunWithoutUsers() {
->expects($this->at(0))
->method('getSystemValueBool')
->with('files_no_background_scan', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config
->expects($this->at(1))
->method('getAppValue')
->with('files', 'cronjob_scan_files', 0)
- ->will($this->returnValue(50));
+ ->willReturn(50);
$this->userManager
->expects($this->at(0))
->method('search')
->with('', 500, 50)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->userManager
->expects($this->at(1))
->method('search')
->with('', 500)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -93,19 +93,19 @@ public function testRunWithUsers() {
->expects($this->at(0))
->method('getSystemValueBool')
->with('files_no_background_scan', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config
->expects($this->at(1))
->method('getAppValue')
->with('files', 'cronjob_scan_files', 0)
- ->will($this->returnValue(50));
+ ->willReturn(50);
$this->userManager
->expects($this->at(0))
->method('search')
->with('', 500, 50)
- ->will($this->returnValue([
+ ->willReturn([
$fakeUser
- ]));
+ ]);
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -123,22 +123,22 @@ public function testRunWithUsersAndOffsetAtEndOfUserList() {
->expects($this->at(0))
->method('getSystemValueBool')
->with('files_no_background_scan', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config
->expects($this->at(1))
->method('getAppValue')
->with('files', 'cronjob_scan_files', 0)
- ->will($this->returnValue(50));
+ ->willReturn(50);
$this->userManager
->expects($this->at(0))
->method('search')
->with('', 500, 50)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->userManager
->expects($this->at(1))
->method('search')
->with('', 500)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->config
->expects($this->at(2))
->method('setAppValue')
diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php
index 8b2a763ec523b..b35d9d7b95d37 100644
--- a/apps/files/tests/Controller/ApiControllerTest.php
+++ b/apps/files/tests/Controller/ApiControllerTest.php
@@ -77,11 +77,11 @@ protected function setUp(): void {
$this->user = $this->createMock(IUser::class);
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('user1'));
+ ->willReturn('user1');
$userSession = $this->createMock(IUserSession::class);
$userSession->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->tagService = $this->getMockBuilder(TagService::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php
index 3182172acfa66..8f2f8fe9ec17d 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -91,10 +91,10 @@ protected function setUp(): void {
$this->user = $this->getMockBuilder(IUser::class)->getMock();
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('testuser1'));
+ ->willReturn('testuser1');
$this->userSession->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->rootFolder = $this->getMockBuilder('\OCP\Files\IRootFolder')->getMock();
$this->activityHelper = $this->createMock(Helper::class);
$this->viewController = $this->getMockBuilder('\OCA\Files\Controller\ViewController')
@@ -121,27 +121,27 @@ public function testIndexWithRegularBrowser() {
$this->viewController
->expects($this->once())
->method('getStorageInfo')
- ->will($this->returnValue([
+ ->willReturn([
'used' => 123,
'quota' => 100,
'total' => 100,
'relative' => 123,
'owner' => 'MyName',
'ownerDisplayName' => 'MyDisplayName',
- ]));
+ ]);
$this->config
->method('getUserValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[$this->user->getUID(), 'files', 'file_sorting', 'name', 'name'],
[$this->user->getUID(), 'files', 'file_sorting_direction', 'asc', 'asc'],
[$this->user->getUID(), 'files', 'show_hidden', false, false],
[$this->user->getUID(), 'files', 'show_grid', true],
- ]));
+ ]);
$this->config
->expects($this->any())
->method('getAppValue')
- ->will($this->returnArgument(2));
+ ->willReturnArgument(2);
$nav = new Template('files', 'appnavigation');
$nav->assign('usage_relative', 123);
@@ -409,29 +409,29 @@ public function testShowFileRouteWithFolder() {
$node = $this->getMockBuilder(Folder::class)->getMock();
$node->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/testuser1/files/test/sub'));
+ ->willReturn('/testuser1/files/test/sub');
$baseFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('testuser1')
- ->will($this->returnValue($baseFolder));
+ ->willReturn($baseFolder);
$baseFolder->expects($this->at(0))
->method('getById')
->with(123)
- ->will($this->returnValue([$node]));
+ ->willReturn([$node]);
$baseFolder->expects($this->at(1))
->method('getRelativePath')
->with('/testuser1/files/test/sub')
- ->will($this->returnValue('/test/sub'));
+ ->willReturn('/test/sub');
$this->urlGenerator
->expects($this->once())
->method('linkToRoute')
->with('files.view.index', ['dir' => '/test/sub'])
- ->will($this->returnValue('/apps/files/?dir=/test/sub'));
+ ->willReturn('/apps/files/?dir=/test/sub');
$expected = new Http\RedirectResponse('/apps/files/?dir=/test/sub');
$this->assertEquals($expected, $this->viewController->index('/whatever', '', '123'));
@@ -441,37 +441,37 @@ public function testShowFileRouteWithFile() {
$parentNode = $this->getMockBuilder(Folder::class)->getMock();
$parentNode->expects($this->once())
->method('getPath')
- ->will($this->returnValue('testuser1/files/test'));
+ ->willReturn('testuser1/files/test');
$baseFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('testuser1')
- ->will($this->returnValue($baseFolder));
+ ->willReturn($baseFolder);
$node = $this->getMockBuilder(File::class)->getMock();
$node->expects($this->once())
->method('getParent')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('somefile.txt'));
+ ->willReturn('somefile.txt');
$baseFolder->expects($this->at(0))
->method('getById')
->with(123)
- ->will($this->returnValue([$node]));
+ ->willReturn([$node]);
$baseFolder->expects($this->at(1))
->method('getRelativePath')
->with('testuser1/files/test')
- ->will($this->returnValue('/test'));
+ ->willReturn('/test');
$this->urlGenerator
->expects($this->once())
->method('linkToRoute')
->with('files.view.index', ['dir' => '/test', 'scrollto' => 'somefile.txt'])
- ->will($this->returnValue('/apps/files/?dir=/test/sub&scrollto=somefile.txt'));
+ ->willReturn('/apps/files/?dir=/test/sub&scrollto=somefile.txt');
$expected = new Http\RedirectResponse('/apps/files/?dir=/test/sub&scrollto=somefile.txt');
$this->assertEquals($expected, $this->viewController->index('/whatever', '', '123'));
@@ -482,12 +482,12 @@ public function testShowFileRouteWithInvalidFileId() {
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('testuser1')
- ->will($this->returnValue($baseFolder));
+ ->willReturn($baseFolder);
$baseFolder->expects($this->at(0))
->method('getById')
->with(123)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
@@ -503,12 +503,12 @@ public function testShowFileRouteWithTrashedFile() {
$this->appManager->expects($this->once())
->method('isEnabledForUser')
->with('files_trashbin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$parentNode = $this->getMockBuilder(Folder::class)->getMock();
$parentNode->expects($this->once())
->method('getPath')
- ->will($this->returnValue('testuser1/files_trashbin/files/test.d1462861890/sub'));
+ ->willReturn('testuser1/files_trashbin/files/test.d1462861890/sub');
$baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock();
$baseFolderTrash = $this->getMockBuilder(Folder::class)->getMock();
@@ -516,39 +516,39 @@ public function testShowFileRouteWithTrashedFile() {
$this->rootFolder->expects($this->at(0))
->method('getUserFolder')
->with('testuser1')
- ->will($this->returnValue($baseFolderFiles));
+ ->willReturn($baseFolderFiles);
$this->rootFolder->expects($this->at(1))
->method('get')
->with('testuser1/files_trashbin/files/')
- ->will($this->returnValue($baseFolderTrash));
+ ->willReturn($baseFolderTrash);
$baseFolderFiles->expects($this->once())
->method('getById')
->with(123)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$node = $this->getMockBuilder(File::class)->getMock();
$node->expects($this->once())
->method('getParent')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->expects($this->once())
->method('getName')
- ->will($this->returnValue('somefile.txt'));
+ ->willReturn('somefile.txt');
$baseFolderTrash->expects($this->at(0))
->method('getById')
->with(123)
- ->will($this->returnValue([$node]));
+ ->willReturn([$node]);
$baseFolderTrash->expects($this->at(1))
->method('getRelativePath')
->with('testuser1/files_trashbin/files/test.d1462861890/sub')
- ->will($this->returnValue('/test.d1462861890/sub'));
+ ->willReturn('/test.d1462861890/sub');
$this->urlGenerator
->expects($this->once())
->method('linkToRoute')
->with('files.view.index', ['view' => 'trashbin', 'dir' => '/test.d1462861890/sub', 'scrollto' => 'somefile.txt'])
- ->will($this->returnValue('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt'));
+ ->willReturn('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt');
$expected = new Http\RedirectResponse('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt');
$this->assertEquals($expected, $this->viewController->index('/whatever', '', '123'));
diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php
index 7366c926b9003..bc7c803953ba3 100644
--- a/apps/files/tests/Service/TagServiceTest.php
+++ b/apps/files/tests/Service/TagServiceTest.php
@@ -85,7 +85,7 @@ protected function setUp(): void {
$this->userSession->expects($this->any())
->method('getUser')
->withAnyParameters()
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->root = \OC::$server->getUserFolder();
$this->dispatcher = $this->createMock(EventDispatcherInterface::class);
diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php
index bcfcaedbac1ca..88569c9cac981 100644
--- a/apps/files_external/tests/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php
@@ -57,22 +57,22 @@ private function getStorageConfig($type, $config = []) {
$storageConfig = $this->createMock(StorageConfig::class);
$storageConfig->expects($this->any())
->method('getType')
- ->will($this->returnValue($type));
+ ->willReturn($type);
$storageConfig->expects($this->any())
->method('getBackendOptions')
- ->will($this->returnCallback(function () use (&$config) {
+ ->willReturnCallback(function () use (&$config) {
return $config;
- }));
+ });
$storageConfig->expects($this->any())
->method('getBackendOption')
- ->will($this->returnCallback(function ($key) use (&$config) {
+ ->willReturnCallback(function ($key) use (&$config) {
return $config[$key];
- }));
+ });
$storageConfig->expects($this->any())
->method('setBackendOption')
- ->will($this->returnCallback(function ($key, $value) use (&$config) {
+ ->willReturnCallback(function ($key, $value) use (&$config) {
$config[$key] = $value;
- }));
+ });
return $storageConfig;
}
@@ -80,7 +80,7 @@ private function getStorageConfig($type, $config = []) {
public function testNoCredentials() {
$this->credentialsManager->expects($this->once())
->method('retrieve')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_ADMIN);
@@ -91,10 +91,10 @@ public function testNoCredentials() {
public function testSavedCredentials() {
$this->credentialsManager->expects($this->once())
->method('retrieve')
- ->will($this->returnValue([
+ ->willReturn([
'user' => 'a',
'password' => 'b'
- ]));
+ ]);
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_ADMIN);
diff --git a/apps/files_external/tests/Command/ApplicableTest.php b/apps/files_external/tests/Command/ApplicableTest.php
index 3b889ceaa7865..49fae6e001316 100644
--- a/apps/files_external/tests/Command/ApplicableTest.php
+++ b/apps/files_external/tests/Command/ApplicableTest.php
@@ -36,11 +36,11 @@ private function getInstance($storageService) {
$userManager->expects($this->any())
->method('userExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$groupManager->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
return new Applicable($storageService, $userManager, $groupManager);
}
diff --git a/apps/files_external/tests/Command/CommandTest.php b/apps/files_external/tests/Command/CommandTest.php
index 39688a2e321a3..2e7e377c28e3b 100644
--- a/apps/files_external/tests/Command/CommandTest.php
+++ b/apps/files_external/tests/Command/CommandTest.php
@@ -53,14 +53,14 @@ protected function getGlobalStorageService(array $mounts = []) {
protected function bindMounts(\PHPUnit_Framework_MockObject_MockObject $mock, array $mounts) {
$mock->expects($this->any())
->method('getStorage')
- ->will($this->returnCallback(function ($id) use ($mounts) {
+ ->willReturnCallback(function ($id) use ($mounts) {
foreach ($mounts as $mount) {
if ($mount->getId() === $id) {
return $mount;
}
}
throw new NotFoundException();
- }));
+ });
}
/**
diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php
index 7dee96e3412d6..3ecf47419b591 100644
--- a/apps/files_external/tests/Controller/StoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/StoragesControllerTest.php
@@ -108,10 +108,10 @@ public function testAddStorage() {
$this->service->expects($this->once())
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$this->service->expects($this->once())
->method('addStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$response = $this->controller->create(
'mount',
@@ -149,10 +149,10 @@ public function testUpdateStorage() {
$this->service->expects($this->once())
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$this->service->expects($this->once())
->method('updateStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$response = $this->controller->update(
1,
@@ -191,7 +191,7 @@ public function testAddOrUpdateStorageInvalidMountPoint($mountPoint) {
$this->service->expects($this->exactly(2))
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$this->service->expects($this->never())
->method('addStorage');
$this->service->expects($this->never())
@@ -282,7 +282,7 @@ public function testUpdateStorageNonExisting() {
$this->service->expects($this->once())
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$this->service->expects($this->once())
->method('updateStorage')
->will($this->throwException(new NotFoundException()));
@@ -332,7 +332,7 @@ public function testGetStorage() {
$this->service->expects($this->once())
->method('getStorage')
->with(1)
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$response = $this->controller->show(1);
$this->assertEquals(Http::STATUS_OK, $response->getStatus());
@@ -360,7 +360,7 @@ public function testValidateStorage($backendValidate, $authMechValidate, $expect
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
- ->will($this->returnValue($authMechValidate));
+ ->willReturn($authMechValidate);
$authMech->method('isVisibleFor')
->willReturn(true);
@@ -372,13 +372,13 @@ public function testValidateStorage($backendValidate, $authMechValidate, $expect
$this->service->expects($this->once())
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
if ($expectSuccess) {
$this->service->expects($this->once())
->method('addStorage')
->with($storageConfig)
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
} else {
$this->service->expects($this->never())
->method('addStorage');
diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
index 920bb72ab70cc..7d8f60380c653 100644
--- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
@@ -76,7 +76,7 @@ public function testAddOrUpdateStorageDisallowedBackend() {
$this->service->expects($this->exactly(2))
->method('createStorage')
- ->will($this->returnValue($storageConfig));
+ ->willReturn($storageConfig);
$this->service->expects($this->never())
->method('addStorage');
$this->service->expects($this->never())
diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php
index 76a8ab326f006..e6a62991f36c2 100644
--- a/apps/files_external/tests/FrontendDefinitionTraitTest.php
+++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php
@@ -101,10 +101,10 @@ public function testValidateStorageSet() {
->willReturn('param');
$param->expects($this->once())
->method('validateValue')
- ->will($this->returnCallback(function(&$value) {
+ ->willReturnCallback(function(&$value) {
$value = 'foobar';
return true;
- }));
+ });
$storageConfig = $this->getMockBuilder(StorageConfig::class)
->disableOriginalConstructor()
diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php
index 09862257ecb56..621894138f4b0 100644
--- a/apps/files_external/tests/PersonalMountTest.php
+++ b/apps/files_external/tests/PersonalMountTest.php
@@ -40,7 +40,7 @@ public function testFindByStorageId() {
$storage->expects($this->any())
->method('getId')
- ->will($this->returnValue('dummy'));
+ ->willReturn('dummy');
$mount = new PersonalMount($storageService, 10, $storage, '/foo');
diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php
index bb65d9a6de6cd..2191060444a93 100644
--- a/apps/files_external/tests/Service/BackendServiceTest.php
+++ b/apps/files_external/tests/Service/BackendServiceTest.php
@@ -51,8 +51,8 @@ protected function getBackendMock($class) {
$backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
- $backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class));
- $backend->method('getIdentifierAliases')->will($this->returnValue(['identifier:'.$class]));
+ $backend->method('getIdentifier')->willReturn('identifier:'.$class);
+ $backend->method('getIdentifierAliases')->willReturn(['identifier:'.$class]);
return $backend;
}
@@ -65,8 +65,8 @@ protected function getAuthMechanismMock($class) {
$backend = $this->getMockBuilder(AuthMechanism::class)
->disableOriginalConstructor()
->getMock();
- $backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class));
- $backend->method('getIdentifierAliases')->will($this->returnValue(['identifier:'.$class]));
+ $backend->method('getIdentifier')->willReturn('identifier:'.$class);
+ $backend->method('getIdentifierAliases')->willReturn(['identifier:'.$class]);
return $backend;
}
@@ -167,10 +167,10 @@ public function testMultipleBackendProviders() {
public function testUserMountingBackends() {
$this->config->expects($this->exactly(2))
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['files_external', 'allow_user_mounting', 'yes', 'yes'],
['files_external', 'user_mounting_backends', '', 'identifier:\User\Mount\Allowed,identifier_alias']
- ]));
+ ]);
$service = new BackendService($this->config);
@@ -201,15 +201,15 @@ public function testGetAvailableBackends() {
$backendAvailable = $this->getBackendMock('\Backend\Available');
$backendAvailable->expects($this->once())
->method('checkDependencies')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$backendNotAvailable = $this->getBackendMock('\Backend\NotAvailable');
$backendNotAvailable->expects($this->once())
->method('checkDependencies')
- ->will($this->returnValue([
+ ->willReturn([
$this->getMockBuilder('\OCA\Files_External\Lib\MissingDependency')
->disableOriginalConstructor()
->getMock()
- ]));
+ ]);
$service->registerBackend($backendAvailable);
$service->registerBackend($backendNotAvailable);
diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php
index a598739b97e5f..9d3a44042e0b9 100644
--- a/apps/files_external/tests/Service/StoragesServiceTest.php
+++ b/apps/files_external/tests/Service/StoragesServiceTest.php
@@ -117,20 +117,20 @@ protected function setUp(): void {
'identifier:\OCA\Files_External\Lib\Auth\NullMechanism' => $this->getAuthMechMock(),
];
$this->backendService->method('getAuthMechanism')
- ->will($this->returnCallback(function ($class) use ($authMechanisms) {
+ ->willReturnCallback(function ($class) use ($authMechanisms) {
if (isset($authMechanisms[$class])) {
return $authMechanisms[$class];
}
return null;
- }));
+ });
$this->backendService->method('getAuthMechanismsByScheme')
- ->will($this->returnCallback(function ($schemes) use ($authMechanisms) {
+ ->willReturnCallback(function ($schemes) use ($authMechanisms) {
return array_filter($authMechanisms, function ($authMech) use ($schemes) {
return in_array($authMech->getScheme(), $schemes, true);
});
- }));
+ });
$this->backendService->method('getAuthMechanisms')
- ->will($this->returnValue($authMechanisms));
+ ->willReturn($authMechanisms);
$sftpBackend = $this->getBackendMock('\OCA\Files_External\Lib\Backend\SFTP', '\OCA\Files_External\Lib\Storage\SFTP');
$backends = [
@@ -142,14 +142,14 @@ protected function setUp(): void {
$backends['identifier:\OCA\Files_External\Lib\Backend\SFTP']->method('getLegacyAuthMechanism')
->willReturn($authMechanisms['identifier:\Other\Auth\Mechanism']);
$this->backendService->method('getBackend')
- ->will($this->returnCallback(function ($backendClass) use ($backends) {
+ ->willReturnCallback(function ($backendClass) use ($backends) {
if (isset($backends[$backendClass])) {
return $backends[$backendClass];
}
return null;
- }));
+ });
$this->backendService->method('getBackends')
- ->will($this->returnValue($backends));
+ ->willReturn($backends);
\OCP\Util::connectHook(
Filesystem::CLASSNAME,
@@ -162,11 +162,11 @@ protected function setUp(): void {
$containerMock = $this->createMock(IAppContainer::class);
$containerMock->method('query')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if ($name === 'OCA\Files_External\Service\BackendService') {
return $this->backendService;
}
- }));
+ });
\OC_Mount_Config::$app = $this->getMockBuilder('\OCA\Files_External\Appinfo\Application')
->disableOriginalConstructor()
diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
index ef8dc8a250ebc..ebdc2e01d529c 100644
--- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
@@ -71,11 +71,11 @@ protected function setUp(): void {
$userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->groupManager->method('isInGroup')
- ->will($this->returnCallback(function ($userId, $groupId) {
+ ->willReturnCallback(function ($userId, $groupId) {
if ($userId === self::USER_ID) {
switch ($groupId) {
case self::GROUP_ID:
@@ -84,15 +84,15 @@ protected function setUp(): void {
}
}
return false;
- }));
+ });
$this->groupManager->method('getUserGroupIds')
- ->will($this->returnCallback(function (IUser $user) {
+ ->willReturnCallback(function (IUser $user) {
if ($user->getUID() === self::USER_ID) {
return [self::GROUP_ID, self::GROUP_ID2];
} else {
return [];
}
- }));
+ });
$this->service = new UserGlobalStoragesService(
$this->backendService,
diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php
index 62f9f6b9d6ca7..cc000c28a80cb 100644
--- a/apps/files_external/tests/Service/UserStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php
@@ -64,7 +64,7 @@ protected function setUp(): void {
$userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->service = new UserStoragesService($this->backendService, $this->dbConfig, $userSession, $this->mountCache);
}
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index cbec30f375e18..c510c4dad9822 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -107,9 +107,9 @@ protected function tearDown(): void {
private function createOCS($userId) {
$l = $this->getMockBuilder(IL10N::class)->getMock();
$l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$config = $this->createMock(IConfig::class);
$appManager = $this->createMock(IAppManager::class);
$serverContainer = $this->createMock(IServerContainer::class);
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index 880921553f39c..a75b474cca991 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -58,7 +58,7 @@ private function getFilesSharingPart(array $data) {
*/
private function getResults(array $map) {
$config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock();
- $config->method('getAppValue')->will($this->returnValueMap($map));
+ $config->method('getAppValue')->willReturnMap($map);
$cap = new Capabilities($config);
$result = $this->getFilesSharingPart($cap->getCapabilities());
return $result;
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 0c2606b360c0b..69b00ff942459 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -122,9 +122,9 @@ protected function setUp(): void {
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->config = $this->createMock(IConfig::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->serverContainer = $this->createMock(IServerContainer::class);
@@ -179,13 +179,13 @@ public function testDeleteShareShareNotFound() {
$this->shareManager
->expects($this->exactly(5))
->method('getShareById')
- ->will($this->returnCallback(function($id) {
+ ->willReturnCallback(function($id) {
if ($id === 'ocinternal:42' || $id === 'ocRoomShare:42' || $id === 'ocFederatedSharing:42' || $id === 'ocCircleShare:42' || $id === 'ocMailShare:42') {
throw new \OCP\Share\Exceptions\ShareNotFound();
} else {
throw new \Exception();
}
- }));
+ });
$this->shareManager->method('outgoingServer2ServerSharesAllowed')->willReturn(true);
@@ -732,7 +732,7 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) {
$userFolder = $this->getMockBuilder('OCP\Files\Folder')->getMock();
$userFolder
->method('getRelativePath')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$userFolder->method('getById')
->with($share->getNodeId())
@@ -761,14 +761,14 @@ public function testGetShare(\OCP\Share\IShare $share, array $result) {
$group = $this->getMockBuilder('OCP\IGroup')->getMock();
$group->method('getGID')->willReturn('groupId');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['userId', $user],
['initiatorId', $initiator],
['ownerId', $owner],
- ]));
- $this->groupManager->method('get')->will($this->returnValueMap([
+ ]);
+ $this->groupManager->method('get')->willReturnMap([
['group', $group],
- ]));
+ ]);
$d = $ocs->getShare($share->getId())->getData()[0];
@@ -1339,14 +1339,14 @@ public function testGetShares(array $getSharesParameters, array $shares, array $
->getMock();
$ocs->method('formatShare')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($share) {
return [
'id' => $share->getId(),
'share_type' => $share->getShareType()
];
}
- ));
+ );
$userFolder = $this->getMockBuilder('OCP\Files\Folder')->getMock();
$userFolder->method('get')
@@ -1359,14 +1359,14 @@ function($share) {
$this->shareManager
->method('getSharesBy')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($user, $shareType, $node) use ($shares) {
if (!isset($shares[$node->getName()]) || !isset($shares[$node->getName()][$shareType])) {
return [];
}
return $shares[$node->getName()][$shareType];
}
- ));
+ );
$this->shareManager
->method('outgoingServer2ServerSharesAllowed')
@@ -1378,11 +1378,11 @@ function($user, $shareType, $node) use ($shares) {
$this->groupManager
->method('isInGroup')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($user, $group) {
return $group === 'currentUserGroup';
}
- ));
+ );
$result = $ocs->getShares(
$getSharesParameters['sharedWithMe'] ?? 'false',
@@ -1448,11 +1448,11 @@ public function testCanAccessShare() {
$group2 = $this->getMockBuilder('OCP\IGroup')->getMock();
$group2->method('inGroup')->with($user)->willReturn(false);
- $this->groupManager->method('get')->will($this->returnValueMap([
+ $this->groupManager->method('get')->willReturnMap([
['group', $group],
['group2', $group2],
['groupnull', null],
- ]));
+ ]);
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
$share = $this->createMock(IShare::class);
@@ -1716,7 +1716,7 @@ public function testCreateShareUser() {
$share->getSharedWith() === 'validUser' &&
$share->getSharedBy() === 'currentUser';
}))
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'validUser');
@@ -1732,7 +1732,7 @@ public function testCreateShareGroupNoValidShareWith() {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- $this->shareManager->method('createShare')->will($this->returnArgument(0));
+ $this->shareManager->method('createShare')->willReturnArgument(0);
$this->shareManager->method('allowGroupSharing')->willReturn(true);
$userFolder = $this->getMockBuilder(Folder::class)->getMock();
@@ -1783,12 +1783,12 @@ public function testCreateShareGroup() {
$this->request
->method('getParam')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['path', null, 'valid-path'],
['permissions', null, \OCP\Constants::PERMISSION_ALL],
['shareType', '-1', \OCP\Share::SHARE_TYPE_GROUP],
['shareWith', null, 'validGroup'],
- ]));
+ ]);
$userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
@@ -1825,7 +1825,7 @@ public function testCreateShareGroup() {
$share->getSharedWith() === 'validGroup' &&
$share->getSharedBy() === 'currentUser';
}))
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, 'validGroup');
@@ -1875,10 +1875,10 @@ public function testCreateShareLinkNoLinksAllowed() {
$this->request
->method('getParam')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['path', null, 'valid-path'],
['shareType', '-1', \OCP\Share::SHARE_TYPE_LINK],
- ]));
+ ]);
$path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->createMock(Storage::class);
@@ -1886,7 +1886,7 @@ public function testCreateShareLinkNoLinksAllowed() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -1905,7 +1905,7 @@ public function testCreateShareLinkNoPublicUpload() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -1925,7 +1925,7 @@ public function testCreateShareLinkPublicUploadFile() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -1944,7 +1944,7 @@ public function testCreateShareLinkPublicUploadFolder() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -1960,7 +1960,7 @@ public function testCreateShareLinkPublicUploadFolder() {
$share->getPassword() === null &&
$share->getExpirationDate() === null;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true', '', null, '');
@@ -1978,7 +1978,7 @@ public function testCreateShareLinkPassword() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -1994,7 +1994,7 @@ public function testCreateShareLinkPassword() {
$share->getPassword() === 'password' &&
$share->getExpirationDate() === null;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', 'password', null, '');
@@ -2012,7 +2012,7 @@ public function testCreateShareLinkSendPasswordByTalk() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -2031,7 +2031,7 @@ public function testCreateShareLinkSendPasswordByTalk() {
$share->getSendPasswordByTalk() === true &&
$share->getExpirationDate() === null;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', 'password', 'true', '');
@@ -2054,7 +2054,7 @@ public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled() {
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
$path->method('getPath')->willReturn('valid-path');
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -2073,13 +2073,13 @@ public function testCreateShareValidExpireDate() {
$this->request
->method('getParam')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['path', null, 'valid-path'],
['shareType', '-1', \OCP\Share::SHARE_TYPE_LINK],
['publicUpload', null, 'false'],
['expireDate', '', '2000-01-01'],
['password', '', ''],
- ]));
+ ]);
$path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->createMock(Storage::class);
@@ -2087,7 +2087,7 @@ public function testCreateShareValidExpireDate() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -2106,7 +2106,7 @@ public function testCreateShareValidExpireDate() {
$share->getPassword() === null &&
$share->getExpirationDate() == $date;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, '2000-01-01');
@@ -2128,7 +2128,7 @@ public function testCreateShareInvalidExpireDate() {
->with('OCA\Files_Sharing\External\Storage')
->willReturn(false);
$path->method('getStorage')->willReturn($storage);
- $this->rootFolder->method('getUserFolder')->with($this->currentUser)->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf();
$this->rootFolder->method('get')->with('valid-path')->willReturn($path);
$this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare());
@@ -2180,7 +2180,7 @@ public function testCreateShareRoom() {
~\OCP\Constants::PERMISSION_DELETE &
~\OCP\Constants::PERMISSION_CREATE,
''
- )->will($this->returnCallback(
+ )->willReturnCallback(
function ($share) {
$share->setSharedWith('recipientRoom');
$share->setPermissions(
@@ -2189,7 +2189,7 @@ function ($share) {
~\OCP\Constants::PERMISSION_CREATE
);
}
- ));
+ );
$this->serverContainer->method('query')
->with('\OCA\Talk\Share\Helper\ShareAPIController')
@@ -2207,7 +2207,7 @@ function ($share) {
$share->getSharedWith() === 'recipientRoom' &&
$share->getSharedBy() === 'currentUser';
}))
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_ROOM, 'recipientRoom');
@@ -2303,11 +2303,11 @@ public function testCreateShareRoomHelperThrowException() {
~\OCP\Constants::PERMISSION_DELETE &
~\OCP\Constants::PERMISSION_CREATE,
''
- )->will($this->returnCallback(
+ )->willReturnCallback(
function ($share) {
throw new OCSNotFoundException("Exception thrown by the helper");
}
- ));
+ );
$this->serverContainer->method('query')
->with('\OCA\Talk\Share\Helper\ShareAPIController')
@@ -2370,7 +2370,7 @@ public function testCreateReshareOfFederatedMountNoDeletePermissions() {
->with($this->callback(function (\OCP\Share\IShare $share) {
return $share->getPermissions() === \OCP\Constants::PERMISSION_READ;
}))
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'validUser');
}
@@ -2479,7 +2479,7 @@ public function testUpdateLinkShareClear() {
$share->getLabel() === '' &&
$share->getHideDownload() === false;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -2534,7 +2534,7 @@ public function testUpdateLinkShareSet() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -2588,7 +2588,7 @@ public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUploa
$share->getPassword() === 'password' &&
$share->getExpirationDate() === null;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
@@ -2729,7 +2729,7 @@ public function testUpdateLinkSharePasswordDoesNotChangeOther() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->updateShare(42, null, 'newpassword', null, null, null, null, null, null);
@@ -2776,7 +2776,7 @@ public function testUpdateLinkShareSendPasswordByTalkDoesNotChangeOther() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->updateShare(42, null, null, 'true', null, null, null, null, null);
@@ -2860,7 +2860,7 @@ public function testUpdateLinkShareDoNotSendPasswordByTalkDoesNotChangeOther() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$expected = new DataResponse([]);
$result = $ocs->updateShare(42, null, null, 'false', null, null, null, null, null);
@@ -2910,7 +2910,7 @@ public function testUpdateLinkShareDoNotSendPasswordByTalkWithTalkDisabledDoesNo
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
@@ -2979,7 +2979,7 @@ public function testUpdateLinkShareExpireDateDoesNotChangeOther() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
@@ -3038,7 +3038,7 @@ public function testUpdateLinkSharePublicUploadDoesNotChangeOther() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -3100,7 +3100,7 @@ public function testUpdateLinkSharePermissions() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')->willReturn([]);
@@ -3161,7 +3161,7 @@ public function testUpdateLinkSharePermissionsShare() {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
@@ -3207,7 +3207,7 @@ public function testUpdateOtherPermissions() {
$this->callback(function (\OCP\Share\IShare $share) {
return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')->willReturn([]);
@@ -3264,19 +3264,19 @@ public function testUpdateShareCannotIncreasePermissions() {
$this->request
->method('getParam')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['permissions', null, '31'],
- ]));
+ ]);
$this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share);
$this->shareManager->expects($this->any())
->method('getSharedWith')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['currentUser', \OCP\Share::SHARE_TYPE_USER, $share->getNode(), -1, 0, []],
['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]],
['currentUser', \OCP\Share::SHARE_TYPE_ROOM, $share->getNode(), -1, 0, []]
- ]));
+ ]);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
@@ -3339,10 +3339,10 @@ public function testUpdateShareCanIncreasePermissionsIfOwner() {
$this->shareManager->expects($this->any())
->method('getSharedWith')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['currentUser', \OCP\Share::SHARE_TYPE_USER, $share->getNode(), -1, 0, []],
['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]]
- ]));
+ ]);
$this->shareManager->expects($this->once())
->method('updateShare')
@@ -4079,13 +4079,13 @@ public function dataFormatShare() {
* @param $exception
*/
public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception) {
- $this->userManager->method('get')->will($this->returnValueMap($users));
+ $this->userManager->method('get')->willReturnMap($users);
$recipientGroup = $this->createMock('\OCP\IGroup');
$recipientGroup->method('getDisplayName')->willReturn('recipientGroupDisplayName');
- $this->groupManager->method('get')->will($this->returnValueMap([
+ $this->groupManager->method('get')->willReturnMap([
['recipientGroup', $recipientGroup],
- ]));
+ ]);
$this->urlGenerator->method('linkToRouteAbsolute')
->with('files_sharing.sharecontroller.showShare', ['token' => 'myToken'])
@@ -4094,7 +4094,7 @@ public function testFormatShare(array $expects, \OCP\Share\IShare $share, array
$this->rootFolder->method('getUserFolder')
->with($this->currentUser)
- ->will($this->returnSelf());
+ ->willReturnSelf();
if (!$exception) {
$this->rootFolder->method('getById')
@@ -4103,14 +4103,14 @@ public function testFormatShare(array $expects, \OCP\Share\IShare $share, array
$this->rootFolder->method('getRelativePath')
->with($share->getNode()->getPath())
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
}
$cm = $this->createMock(\OCP\Contacts\IManager::class);
$this->overwriteService(\OCP\Contacts\IManager::class, $cm);
$cm->method('search')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['user@server.com', ['CLOUD'], [],
[
[
@@ -4131,7 +4131,7 @@ public function testFormatShare(array $expects, \OCP\Share\IShare $share, array
],
],
],
- ]));
+ ]);
try {
$result = $this->invokePrivate($this->ocs, 'formatShare', [$share]);
@@ -4271,7 +4271,7 @@ public function dataFormatRoomShare() {
public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper) {
$this->rootFolder->method('getUserFolder')
->with($this->currentUser)
- ->will($this->returnSelf());
+ ->willReturnSelf();
$this->rootFolder->method('getById')
->with($share->getNodeId())
@@ -4279,7 +4279,7 @@ public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bo
$this->rootFolder->method('getRelativePath')
->with($share->getNode()->getPath())
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
if (!$helperAvailable) {
$this->appManager->method('isEnabledForUser')
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index fbce22b403ff1..35807dffe821b 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -282,9 +282,9 @@ public function testShowShare() {
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters) {
+ ->willReturnCallback(function($text, $parameters) {
return vsprintf($text, $parameters);
- }));
+ });
$response = $this->shareController->showShare();
$sharedTmplParams = array(
@@ -422,9 +422,9 @@ public function testShowShareHideDownload() {
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters) {
+ ->willReturnCallback(function($text, $parameters) {
return vsprintf($text, $parameters);
- }));
+ });
$response = $this->shareController->showShare();
$sharedTmplParams = array(
@@ -531,9 +531,9 @@ public function testShareFileDrop() {
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters) {
+ ->willReturnCallback(function($text, $parameters) {
return vsprintf($text, $parameters);
- }));
+ });
$response = $this->shareController->showShare();
// skip the "folder" param for tests
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
index 68c827dd922e3..7319a1bd429cc 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -291,13 +291,13 @@ public function testSearch($getData, $apiSetting, $enumSetting, $remoteSharingEn
$this->shareManager->expects($this->any())
->method('shareProviderExists')
- ->will($this->returnCallback(function($shareType) use ($emailSharingEnabled) {
+ ->willReturnCallback(function($shareType) use ($emailSharingEnabled) {
if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
return $emailSharingEnabled;
} else {
return false;
}
- }));
+ });
$this->assertInstanceOf(Http\DataResponse::class, $sharees->search($search, $itemType, $page, $perPage, $shareType));
}
diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php
index 946faae3d086e..766f0232b87ef 100644
--- a/apps/files_sharing/tests/External/CacheTest.php
+++ b/apps/files_sharing/tests/External/CacheTest.php
@@ -69,7 +69,7 @@ protected function setUp(): void {
$this->storage
->expects($this->any())
->method('getId')
- ->will($this->returnValue('dummystorage::'));
+ ->willReturn('dummystorage::');
$this->cache = new \OCA\Files_Sharing\External\Cache(
$this->storage,
$this->cloudIdManager->getCloudId($this->remoteUser, 'http://example.com/owncloud')
diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
index 927cdd8a0536d..e4d6cefac4ff8 100644
--- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
@@ -51,7 +51,7 @@ protected function setUp(): void {
$this->shareManager = $this->createMock(IManager::class);
$this->l = $this->createMock(IL10N::class);
- $this->l->method('t')->will($this->returnArgument(0));
+ $this->l->method('t')->willReturnArgument(0);
$this->middleware = new OCSShareAPIMiddleware($this->shareManager, $this->l);
}
diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
index 54db20c239e9b..4a6d3859b03b0 100644
--- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
@@ -83,7 +83,7 @@ public function testIsSharingEnabledWithAppEnabled() {
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled'));
}
@@ -93,7 +93,7 @@ public function testIsSharingEnabledWithAppDisabled() {
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled'));
}
@@ -142,11 +142,11 @@ public function testExternalSharesChecks($annotations, $config, $expectedResult)
$this->reflector
->expects($this->atLeastOnce())
->method('hasAnnotation')
- ->will($this->returnValueMap($annotations));
+ ->willReturnMap($annotations);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap($config));
+ ->willReturnMap($config);
$this->assertEquals($expectedResult, self::invokePrivate($this->sharingCheckMiddleware, 'externalSharesChecks'));
}
@@ -159,16 +159,16 @@ public function testBeforeControllerWithExternalShareControllerWithSharingEnable
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reflector
->expects($this->atLeastOnce())
->method('hasAnnotation')
- ->will($this->returnValueMap($annotations));
+ ->willReturnMap($annotations);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap($config));
+ ->willReturnMap($config);
$controller = $this->createMock(ExternalSharesController::class);
@@ -191,7 +191,7 @@ public function testBeforeControllerWithShareControllerWithSharingEnabled() {
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$controller = $this->createMock(ShareController::class);
@@ -207,7 +207,7 @@ public function testBeforeControllerWithSharingDisabled() {
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->sharingCheckMiddleware->beforeController($this->controllerMock, 'myMethod');
}
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index f80b5840bcf78..fafed2123f1b3 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -76,25 +76,25 @@ private function makeMockShare($id, $nodeId, $owner = 'user2', $target = null, $
$share = $this->createMock(IShare::class);
$share->expects($this->any())
->method('getPermissions')
- ->will($this->returnValue($permissions));
+ ->willReturn($permissions);
$share->expects($this->any())
->method('getShareOwner')
- ->will($this->returnValue($owner));
+ ->willReturn($owner);
$share->expects($this->any())
->method('getTarget')
- ->will($this->returnValue($target));
+ ->willReturn($target);
$share->expects($this->any())
->method('getId')
- ->will($this->returnValue($id));
+ ->willReturn($id);
$share->expects($this->any())
->method('getNodeId')
- ->will($this->returnValue($nodeId));
+ ->willReturn($nodeId);
$share->expects($this->any())
->method('getShareTime')
- ->will($this->returnValue(
+ ->willReturn(
// compute share time based on id, simulating share order
new \DateTime('@' . (1469193980 + 1000 * $id))
- ));
+ );
return $share;
}
@@ -125,28 +125,28 @@ public function testExcludeShares() {
$circleShares = [];
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('user1'));
+ ->willReturn('user1');
$this->shareManager->expects($this->at(0))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_USER)
- ->will($this->returnValue($userShares));
+ ->willReturn($userShares);
$this->shareManager->expects($this->at(1))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)
- ->will($this->returnValue($groupShares));
+ ->willReturn($groupShares);
$this->shareManager->expects($this->at(2))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)
- ->will($this->returnValue($circleShares));
+ ->willReturn($circleShares);
$this->shareManager->expects($this->at(3))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_ROOM, null, -1)
- ->will($this->returnValue($roomShares));
+ ->willReturn($roomShares);
$this->shareManager->expects($this->any())
->method('newShare')
- ->will($this->returnCallback(function() use ($rootFolder, $userManager) {
+ ->willReturnCallback(function() use ($rootFolder, $userManager) {
return new \OC\Share20\Share($rootFolder, $userManager);
- }));
+ });
$mounts = $this->provider->getMountsForUser($this->user, $this->loader);
$this->assertCount(3, $mounts);
$this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[0]);
@@ -330,7 +330,7 @@ public function testMergeShares($userShares, $groupShares, $expectedShares, $mov
$this->user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('user1'));
+ ->willReturn('user1');
// tests regarding circles are made in the app itself.
$circleShares = [];
@@ -338,24 +338,24 @@ public function testMergeShares($userShares, $groupShares, $expectedShares, $mov
$this->shareManager->expects($this->at(0))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_USER)
- ->will($this->returnValue($userShares));
+ ->willReturn($userShares);
$this->shareManager->expects($this->at(1))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)
- ->will($this->returnValue($groupShares));
+ ->willReturn($groupShares);
$this->shareManager->expects($this->at(2))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)
- ->will($this->returnValue($circleShares));
+ ->willReturn($circleShares);
$this->shareManager->expects($this->at(3))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_ROOM, null, -1)
- ->will($this->returnValue($roomShares));
+ ->willReturn($roomShares);
$this->shareManager->expects($this->any())
->method('newShare')
- ->will($this->returnCallback(function() use ($rootFolder, $userManager) {
+ ->willReturnCallback(function() use ($rootFolder, $userManager) {
return new \OC\Share20\Share($rootFolder, $userManager);
- }));
+ });
if ($moveFails) {
$this->shareManager->expects($this->any())
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index eb4e46355214b..6b57d111ea9a3 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -476,13 +476,13 @@ public function testSingleStorageDeleteFileFail() {
$storage->expects($this->any())
->method('rename')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$storage->expects($this->any())
->method('moveFromStorage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$storage->expects($this->any())
->method('unlink')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$cache = $storage->getCache();
@@ -513,7 +513,7 @@ public function testSingleStorageDeleteFolderFail() {
$storage->expects($this->any())
->method('rmdir')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$cache = $storage->getCache();
diff --git a/apps/files_trashbin/tests/TrashbinTest.php b/apps/files_trashbin/tests/TrashbinTest.php
index e682d0dd51f40..4465bfbab3c05 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -122,13 +122,13 @@ protected function setUp(): void {
$mockConfig = $this->createMock(\OCP\IConfig::class);
$mockConfig->expects($this->any())
->method('getSystemValue')
- ->will($this->returnCallback(function ($key, $default) use ($config) {
+ ->willReturnCallback(function ($key, $default) use ($config) {
if ($key === 'filesystem_check_changes') {
return \OC\Files\Cache\Watcher::CHECK_ONCE;
} else {
return $config->getSystemValue($key, $default);
}
- }));
+ });
$this->overwriteService(\OC\AllConfig::class, $mockConfig);
$this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index e07a1816c3062..53179bd6b30b1 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -86,13 +86,13 @@ protected function setUp(): void {
$mockConfig = $this->createMock(IConfig::class);
$mockConfig->expects($this->any())
->method('getSystemValue')
- ->will($this->returnCallback(function ($key, $default) use ($config) {
+ ->willReturnCallback(function ($key, $default) use ($config) {
if ($key === 'filesystem_check_changes') {
return \OC\Files\Cache\Watcher::CHECK_ONCE;
} else {
return $config->getSystemValue($key, $default);
}
- }));
+ });
$this->overwriteService(\OC\AllConfig::class, $mockConfig);
// clear hooks
@@ -745,11 +745,11 @@ private function connectMockHooks($hookName, &$params) {
$eventHandler->expects($this->any())
->method('callback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($p) use (&$params) {
$params = $p;
}
- ));
+ );
\OCP\Util::connectHook(
'\OCP\Versions',
diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php
index 4fca0eaa90c0f..820c8e041ace7 100644
--- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php
+++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php
@@ -248,9 +248,9 @@ public function testGetTokenValidAppToken() {
->with($accessToken);
$this->secureRandom->method('generate')
- ->will($this->returnCallback(function ($len) {
+ ->willReturnCallback(function ($len) {
return 'random'.$len;
- }));
+ });
$this->tokenProvider->expects($this->once())
->method('rotate')
@@ -340,9 +340,9 @@ public function testGetTokenValidAppTokenBasicAuth() {
->with($accessToken);
$this->secureRandom->method('generate')
- ->will($this->returnCallback(function ($len) {
+ ->willReturnCallback(function ($len) {
return 'random'.$len;
- }));
+ });
$this->tokenProvider->expects($this->once())
->method('rotate')
@@ -435,9 +435,9 @@ public function testGetTokenExpiredAppToken() {
->with($accessToken);
$this->secureRandom->method('generate')
- ->will($this->returnCallback(function ($len) {
+ ->willReturnCallback(function ($len) {
return 'random'.$len;
- }));
+ });
$this->tokenProvider->expects($this->once())
->method('rotate')
diff --git a/apps/oauth2/tests/Controller/SettingsControllerTest.php b/apps/oauth2/tests/Controller/SettingsControllerTest.php
index 76a4fb55ae6ea..1a6f20fcf8015 100644
--- a/apps/oauth2/tests/Controller/SettingsControllerTest.php
+++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php
@@ -100,10 +100,10 @@ public function testAddClient() {
$c->getRedirectUri() === 'https://example.com/' &&
$c->getSecret() === 'MySecret' &&
$c->getClientIdentifier() === 'MyClientIdentifier';
- }))->will($this->returnCallback(function (Client $c) {
+ }))->willReturnCallback(function (Client $c) {
$c->setId(42);
return $c;
- }));
+ });
$result = $this->settingsController->addClient('My Client Name', 'https://example.com/');
$this->assertInstanceOf(JSONResponse::class, $result);
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index 742f621c6a4ac..5416e686ee346 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -167,12 +167,12 @@ private function asSubAdminOfGroup($group) {
$this->subAdminManager
->method('isSubAdminOfGroup')
- ->will($this->returnCallback(function($_user, $_group) use ($user, $group) {
+ ->willReturnCallback(function($_user, $_group) use ($user, $group) {
if ($_user === $user && $_group === $group) {
return true;
}
return false;
- }));
+ });
}
private function useAccountManager() {
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index ac2da91005e0c..05c9506d6ec60 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -141,20 +141,20 @@ public function testGetUsersAsAdmin() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userManager
->expects($this->once())
->method('search')
->with('MyCustomSearch')
- ->will($this->returnValue(['Admin' => [], 'Foo' => [], 'Bar' => []]));
+ ->willReturn(['Admin' => [], 'Foo' => [], 'Bar' => []]);
$expected = ['users' => [
'Admin',
@@ -172,45 +172,45 @@ public function testGetUsersAsSubAdmin() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$firstGroup = $this->getMockBuilder('OCP\IGroup')
->disableOriginalConstructor()
->getMock();
$firstGroup
->expects($this->once())
->method('getGID')
- ->will($this->returnValue('FirstGroup'));
+ ->willReturn('FirstGroup');
$secondGroup = $this->getMockBuilder('OCP\IGroup')
->disableOriginalConstructor()
->getMock();
$secondGroup
->expects($this->once())
->method('getGID')
- ->will($this->returnValue('SecondGroup'));
+ ->willReturn('SecondGroup');
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdmin')
->with($loggedInUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
->with($loggedInUser)
- ->will($this->returnValue([$firstGroup, $secondGroup]));
+ ->willReturn([$firstGroup, $secondGroup]);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('displayNamesInGroup')
@@ -234,7 +234,7 @@ public function testAddUserAlreadyExisting() {
->expects($this->once())
->method('userExists')
->with('AlreadyExistingUser')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->logger
->expects($this->once())
->method('error')
@@ -245,11 +245,11 @@ public function testAddUserAlreadyExisting() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -276,11 +276,11 @@ public function testAddUserNonExistingGroup() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -312,11 +312,11 @@ public function testAddUserExistingGroupNonExistingGroup() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -329,10 +329,10 @@ public function testAddUserExistingGroupNonExistingGroup() {
['ExistingGroup'],
['NonExistingGroup']
)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['ExistingGroup', true],
['NonExistingGroup', false]
- ]));
+ ]);
$this->api->addUser('NewUser', 'pass', '', '', ['ExistingGroup', 'NonExistingGroup']);
}
@@ -342,7 +342,7 @@ public function testAddUserSuccessful() {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -357,11 +357,11 @@ public function testAddUserSuccessful() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -399,7 +399,7 @@ public function testAddUserSuccessfulWithDisplayName() {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -414,11 +414,11 @@ public function testAddUserSuccessfulWithDisplayName() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -449,7 +449,7 @@ public function testAddUserSuccessfulGenerateUserID() {
->expects($this->any())
->method('userExists')
->with($this->anything())
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -464,11 +464,11 @@ public function testAddUserSuccessfulGenerateUserID() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -504,7 +504,7 @@ public function testAddUserFailedToGenerateUserID() {
->expects($this->any())
->method('userExists')
->with($this->anything())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userManager
->expects($this->never())
->method('createUser');
@@ -514,11 +514,11 @@ public function testAddUserFailedToGenerateUserID() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -547,7 +547,7 @@ public function testAddUserEmailRequired() {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->never())
->method('createUser');
@@ -557,11 +557,11 @@ public function testAddUserEmailRequired() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -586,11 +586,11 @@ public function testAddUserExistingGroup() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -646,7 +646,7 @@ public function testAddUserUnsuccessful() {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -666,11 +666,11 @@ public function testAddUserUnsuccessful() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('adminUser'));
+ ->willReturn('adminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -692,11 +692,11 @@ public function testAddUserAsSubAdminNoGroup() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('regularUser'));
+ ->willReturn('regularUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -725,11 +725,11 @@ public function testAddUserAsSubAdminValidGroupNotSubAdmin() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('regularUser'));
+ ->willReturn('regularUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -774,11 +774,11 @@ public function testAddUserAsSubAdminExistingGroups() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('subAdminUser'));
+ ->willReturn('subAdminUser');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
@@ -823,10 +823,10 @@ public function testAddUserAsSubAdminExistingGroups() {
['ExistingGroup1'],
['ExistingGroup2']
)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['ExistingGroup1', $existingGroup1],
['ExistingGroup2', $existingGroup2]
- ]));
+ ]);
$this->logger
->expects($this->exactly(3))
->method('info')
@@ -868,12 +868,12 @@ public function testGetUserTargetDoesNotExist() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->getUser('UserToGet');
}
@@ -891,7 +891,7 @@ public function testGetUserDataAsAdmin() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -901,17 +901,17 @@ public function testGetUserDataAsAdmin() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->exactly(2))
->method('get')
->with('UID')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->any())
->method('getUserGroups')
@@ -919,7 +919,7 @@ public function testGetUserDataAsAdmin() {
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -950,17 +950,17 @@ public function testGetUserDataAsAdmin() {
->expects($this->at(0))
->method('getUserValue')
->with('UID', 'core', 'enabled', 'true')
- ->will($this->returnValue('true'));
+ ->willReturn('true');
$this->config
->expects($this->at(1))
->method('getUserValue')
->with('UID', 'core', 'lang')
- ->will($this->returnValue('de'));
+ ->willReturn('de');
$this->api
->expects($this->once())
->method('fillStorageInfo')
->with('UID')
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
$backend->expects($this->any())
@@ -970,19 +970,19 @@ public function testGetUserDataAsAdmin() {
$targetUser
->expects($this->once())
->method('getDisplayName')
- ->will($this->returnValue('Demo User'));
+ ->willReturn('Demo User');
$targetUser
->expects($this->once())
->method('getHome')
- ->will($this->returnValue('/var/www/newtcloud/data/UID'));
+ ->willReturn('/var/www/newtcloud/data/UID');
$targetUser
->expects($this->once())
->method('getLastLogin')
- ->will($this->returnValue(1521191471));
+ ->willReturn(1521191471);
$targetUser
->expects($this->once())
->method('getBackendClassName')
- ->will($this->returnValue('Database'));
+ ->willReturn('Database');
$targetUser
->expects($this->once())
->method('getBackend')
@@ -990,7 +990,7 @@ public function testGetUserDataAsAdmin() {
$targetUser
->expects($this->exactly(6))
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$expected = [
'id' => 'UID',
@@ -1024,7 +1024,7 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -1035,17 +1035,17 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->exactly(2))
->method('get')
->with('UID')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->any())
->method('getUserGroups')
@@ -1057,7 +1057,7 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -1065,22 +1065,22 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
$this->groupManager
->expects($this->exactly(2))
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->config
->expects($this->at(0))
->method('getUserValue')
->with('UID', 'core', 'enabled', 'true')
- ->will($this->returnValue('true'));
+ ->willReturn('true');
$this->config
->expects($this->at(1))
->method('getUserValue')
->with('UID', 'core', 'lang')
- ->will($this->returnValue('da'));
+ ->willReturn('da');
$this->api
->expects($this->once())
->method('fillStorageInfo')
->with('UID')
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
$backend->expects($this->any())
@@ -1090,19 +1090,19 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
$targetUser
->expects($this->once())
->method('getDisplayName')
- ->will($this->returnValue('Demo User'));
+ ->willReturn('Demo User');
$targetUser
->expects($this->once())
->method('getHome')
- ->will($this->returnValue('/var/www/newtcloud/data/UID'));
+ ->willReturn('/var/www/newtcloud/data/UID');
$targetUser
->expects($this->once())
->method('getLastLogin')
- ->will($this->returnValue(1521191471));
+ ->willReturn(1521191471);
$targetUser
->expects($this->once())
->method('getBackendClassName')
- ->will($this->returnValue('Database'));
+ ->willReturn('Database');
$targetUser
->expects($this->once())
->method('getBackend')
@@ -1110,7 +1110,7 @@ public function testGetUserDataAsSubAdminAndUserIsAccessible() {
$targetUser
->expects($this->exactly(6))
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->accountManager->expects($this->any())->method('getUser')
->with($targetUser)
->willReturn(
@@ -1159,24 +1159,24 @@ public function testGetUserDataAsSubAdminAndUserIsNotAccessible() {
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -1184,11 +1184,11 @@ public function testGetUserDataAsSubAdminAndUserIsNotAccessible() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->invokePrivate($this->api, 'getUser', ['UserToGet']);
}
@@ -1200,24 +1200,24 @@ public function testGetUserDataAsSubAdminSelfLookup() {
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->exactly(2))
->method('get')
->with('UID')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('UID')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -1225,7 +1225,7 @@ public function testGetUserDataAsSubAdminSelfLookup() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -1233,7 +1233,7 @@ public function testGetUserDataAsSubAdminSelfLookup() {
$this->groupManager
->expects($this->exactly(2))
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('getUserGroups')
@@ -1242,7 +1242,7 @@ public function testGetUserDataAsSubAdminSelfLookup() {
->expects($this->once())
->method('fillStorageInfo')
->with('UID')
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$backend = $this->createMock(UserInterface::class);
$backend->expects($this->atLeastOnce())
@@ -1252,27 +1252,27 @@ public function testGetUserDataAsSubAdminSelfLookup() {
$targetUser
->expects($this->once())
->method('getDisplayName')
- ->will($this->returnValue('Subadmin User'));
+ ->willReturn('Subadmin User');
$targetUser
->expects($this->once())
->method('getEMailAddress')
- ->will($this->returnValue('subadmin@nextcloud.com'));
+ ->willReturn('subadmin@nextcloud.com');
$targetUser
->expects($this->exactly(6))
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser
->expects($this->once())
->method('getHome')
- ->will($this->returnValue('/var/www/newtcloud/data/UID'));
+ ->willReturn('/var/www/newtcloud/data/UID');
$targetUser
->expects($this->once())
->method('getLastLogin')
- ->will($this->returnValue(1521191471));
+ ->willReturn(1521191471);
$targetUser
->expects($this->once())
->method('getBackendClassName')
- ->will($this->returnValue('Database'));
+ ->willReturn('Database');
$targetUser
->expects($this->once())
->method('getBackend')
@@ -1281,7 +1281,7 @@ public function testGetUserDataAsSubAdminSelfLookup() {
->expects($this->at(0))
->method('getUserValue')
->with('UID', 'core', 'lang')
- ->will($this->returnValue('ru'));
+ ->willReturn('ru');
$this->accountManager->expects($this->any())->method('getUser')
->with($targetUser)
->willReturn(
@@ -1324,19 +1324,19 @@ public function testEditUserRegularUserSelfEditChangeDisplayName() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$targetUser
->expects($this->once())
->method('setDisplayName')
@@ -1344,7 +1344,7 @@ public function testEditUserRegularUserSelfEditChangeDisplayName() {
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'display', 'NewDisplayName')->getData());
}
@@ -1356,19 +1356,19 @@ public function testEditUserRegularUserSelfEditChangeEmailValid() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$targetUser
->expects($this->once())
->method('setEMailAddress')
@@ -1376,7 +1376,7 @@ public function testEditUserRegularUserSelfEditChangeEmailValid() {
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'email', 'demo@nextcloud.com')->getData());
}
@@ -1393,23 +1393,23 @@ public function testEditUserRegularUserSelfEditChangeEmailInvalid() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->api->editUser('UserToEdit', 'email', 'demo.org');
}
@@ -1421,23 +1421,23 @@ public function testEditUserRegularUserSelfEditChangePassword() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$targetUser
->expects($this->once())
->method('canChangePassword')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetUser
->expects($this->once())
->method('setPassword')
@@ -1445,7 +1445,7 @@ public function testEditUserRegularUserSelfEditChangePassword() {
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'password', 'NewPassword')->getData());
}
@@ -1462,23 +1462,23 @@ public function testEditUserRegularUserSelfEditChangeQuota() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->api->editUser('UserToEdit', 'quota', 'NewQuota');
}
@@ -1488,7 +1488,7 @@ public function testEditUserAdminUserSelfEditChangeValidQuota() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
@@ -1496,21 +1496,21 @@ public function testEditUserAdminUserSelfEditChangeValidQuota() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->exactly(3))
->method('isAdmin')
->with('UID')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -1526,26 +1526,26 @@ public function testEditUserAdminUserSelfEditChangeInvalidQuota() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->exactly(3))
->method('isAdmin')
->with('UID')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->api->editUser('UserToEdit', 'quota', 'ABC');
}
@@ -1555,7 +1555,7 @@ public function testEditUserAdminUserEditChangeValidQuota() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
@@ -1563,28 +1563,28 @@ public function testEditUserAdminUserEditChangeValidQuota() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -1605,7 +1605,7 @@ public function testEditUserSelfEditChangeLanguage() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$targetUser = $this->createMock(IUser::class);
$this->config->expects($this->once())
->method('setUserValue')
@@ -1613,21 +1613,21 @@ public function testEditUserSelfEditChangeLanguage() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->atLeastOnce())
->method('isAdmin')
->with('UserToEdit')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1656,28 +1656,28 @@ public function testEditUserSelfEditChangeLanguageButForced($forced) {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$targetUser = $this->createMock(IUser::class);
$this->config->expects($this->never())
->method('setUserValue');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->atLeastOnce())
->method('isAdmin')
->with('UserToEdit')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1692,7 +1692,7 @@ public function testEditUserAdminEditChangeLanguage() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->createMock(IUser::class);
$this->config->expects($this->once())
->method('setUserValue')
@@ -1700,26 +1700,26 @@ public function testEditUserAdminEditChangeLanguage() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager = $this->createMock(SubAdmin::class);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1739,33 +1739,33 @@ public function testEditUserAdminEditChangeLanguageInvalidLanguage() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->createMock(IUser::class);
$this->config->expects($this->never())
->method('setUserValue');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager = $this->createMock(SubAdmin::class);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'ru')->getData());
}
@@ -1775,7 +1775,7 @@ public function testEditUserSubadminUserAccessible() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
@@ -1783,12 +1783,12 @@ public function testEditUserSubadminUserAccessible() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -1796,15 +1796,15 @@ public function testEditUserSubadminUserAccessible() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -1818,17 +1818,17 @@ public function testEditUserSubadminUserInaccessible() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToEdit')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -1836,15 +1836,15 @@ public function testEditUserSubadminUserInaccessible() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->api->editUser('UserToEdit', 'quota', 'value');
}
@@ -1858,16 +1858,16 @@ public function testDeleteUserNotExistingUser() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UserToEdit'));
+ ->willReturn('UserToEdit');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->deleteUser('UserToDelete');
}
@@ -1881,21 +1881,21 @@ public function testDeleteUserSelf() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->api->deleteUser('UserToDelete');
}
@@ -1905,30 +1905,30 @@ public function testDeleteSuccessfulUserAsAdmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetUser
->expects($this->once())
->method('delete')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertEquals([], $this->api->deleteUser('UserToDelete')->getData());
}
@@ -1942,30 +1942,30 @@ public function testDeleteUnsuccessfulUserAsAdmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetUser
->expects($this->once())
->method('delete')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->api->deleteUser('UserToDelete');
}
@@ -1975,41 +1975,41 @@ public function testDeleteSuccessfulUserAsSubadmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('delete')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertEquals([], $this->api->deleteUser('UserToDelete')->getData());
}
@@ -2023,41 +2023,41 @@ public function testDeleteUnsuccessfulUserAsSubadmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('delete')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->api->deleteUser('UserToDelete');
}
@@ -2071,37 +2071,37 @@ public function testDeleteUserAsSubAdminAndUserIsNotAccessible() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToDelete')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->api->deleteUser('UserToDelete');
}
@@ -2115,7 +2115,7 @@ public function testGetUsersGroupsTargetUserNotExisting() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->getUsersGroups('UserToLookup');
}
@@ -2125,26 +2125,26 @@ public function testGetUsersGroupsSelfTargetted() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToLookup'));
+ ->willReturn('UserToLookup');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToLookup'));
+ ->willReturn('UserToLookup');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToLookup')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('getUserGroupIds')
->with($targetUser)
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$this->assertEquals(['groups' => ['DummyValue']], $this->api->getUsersGroups('UserToLookup')->getData());
}
@@ -2154,31 +2154,31 @@ public function testGetUsersGroupsForAdminUser() {
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToLookup'));
+ ->willReturn('UserToLookup');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToLookup')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('getUserGroupIds')
->with($targetUser)
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertEquals(['groups' => ['DummyValue']], $this->api->getUsersGroups('UserToLookup')->getData());
}
@@ -2188,57 +2188,57 @@ public function testGetUsersGroupsForSubAdminUserAndUserIsAccessible() {
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToLookup'));
+ ->willReturn('UserToLookup');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToLookup')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$group1 = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$group1
->expects($this->any())
->method('getGID')
- ->will($this->returnValue('Group1'));
+ ->willReturn('Group1');
$group2 = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$group2
->expects($this->any())
->method('getGID')
- ->will($this->returnValue('Group2'));
+ ->willReturn('Group2');
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
->with($loggedInUser)
- ->will($this->returnValue([$group1, $group2]));
+ ->willReturn([$group1, $group2]);
$this->groupManager
->expects($this->any())
->method('getUserGroupIds')
->with($targetUser)
- ->will($this->returnValue(['Group1']));
+ ->willReturn(['Group1']);
$this->assertEquals(['groups' => ['Group1']], $this->api->getUsersGroups('UserToLookup')->getData());
}
@@ -2252,42 +2252,42 @@ public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible() {
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('UserToLookup'));
+ ->willReturn('UserToLookup');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToLookup')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('getUserGroupIds')
->with($targetUser)
- ->will($this->returnValue(['Group1']));
+ ->willReturn(['Group1']);
$this->api->getUsersGroups('UserToLookup');
}
@@ -2470,7 +2470,7 @@ public function testRemoveFromGroupWithNoTargetGroup() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->removeFromGroup('TargetUser', '');
}
@@ -2484,7 +2484,7 @@ public function testRemoveFromGroupWithEmptyTargetGroup() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->removeFromGroup('TargetUser', '');
}
@@ -2498,12 +2498,12 @@ public function testRemoveFromGroupWithNotExistingTargetGroup() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('TargetGroup')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
}
@@ -2518,17 +2518,17 @@ public function testRemoveFromGroupWithNotExistingTargetUser() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('TargetGroup')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('TargetUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
}
@@ -2542,34 +2542,34 @@ public function testRemoveFromGroupWithoutPermission() {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('unauthorizedUser'));
+ ->willReturn('unauthorizedUser');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('TargetGroup')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('TargetUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('unauthorizedUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
}
@@ -2584,42 +2584,42 @@ public function testRemoveFromGroupAsAdminFromAdmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->once())
->method('getGID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('admin')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('Admin')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->api->removeFromGroup('Admin', 'admin');
}
@@ -2634,47 +2634,47 @@ public function testRemoveFromGroupAsSubAdminFromSubAdmin() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->any())
->method('getGID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('subadmin')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('SubAdmin')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($loggedInUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->api->removeFromGroup('SubAdmin', 'subadmin');
}
@@ -2689,49 +2689,49 @@ public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->any())
->method('getGID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('subadmin')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('AnotherUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($loggedInUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
->with($loggedInUser)
- ->will($this->returnValue([$targetGroup]));
+ ->willReturn([$targetGroup]);
$this->groupManager
->expects($this->any())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getUserGroupIds')
@@ -2746,34 +2746,34 @@ public function testRemoveFromGroupSuccessful() {
$loggedInUser
->expects($this->any())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('admin')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->userManager
->expects($this->once())
->method('get')
->with('AnotherUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
->method('isAdmin')
->with('admin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$targetGroup
->expects($this->once())
->method('removeUser')
@@ -2792,7 +2792,7 @@ public function testAddSubAdminWithNotExistingTargetUser() {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->addSubAdmin('NotExistingUser', '');
}
@@ -2809,12 +2809,12 @@ public function testAddSubAdminWithNotExistingTargetGroup() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('NotExistingGroup')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->addSubAdmin('ExistingUser', 'NotExistingGroup');
}
@@ -2830,17 +2830,17 @@ public function testAddSubAdminToAdminGroup() {
$targetGroup
->expects($this->once())
->method('getGID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$this->userManager
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('ADmiN')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$this->api->addSubAdmin('ExistingUser', 'ADmiN');
}
@@ -2852,23 +2852,23 @@ public function testAddSubAdminTwice() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('TargetGroup')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->assertEquals([], $this->api->addSubAdmin('ExistingUser', 'TargetGroup')->getData());
}
@@ -2880,28 +2880,28 @@ public function testAddSubAdminSuccessful() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('TargetGroup')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager
->expects($this->once())
->method('createSubAdmin')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->assertEquals([], $this->api->addSubAdmin('ExistingUser', 'TargetGroup')->getData());
}
@@ -2916,7 +2916,7 @@ public function testRemoveSubAdminNotExistingTargetUser() {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->removeSubAdmin('NotExistingUser', 'GroupToDeleteFrom');
}
@@ -2932,12 +2932,12 @@ public function testRemoveSubAdminNotExistingTargetGroup() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('GroupToDeleteFrom')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom');
}
@@ -2955,23 +2955,23 @@ public function testRemoveSubAdminFromNotASubadmin() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('GroupToDeleteFrom')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom');
}
@@ -2983,28 +2983,28 @@ public function testRemoveSubAdminSuccessful() {
->expects($this->once())
->method('get')
->with('ExistingUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('get')
->with('GroupToDeleteFrom')
- ->will($this->returnValue($targetGroup));
+ ->willReturn($targetGroup);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('isSubAdminOfGroup')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager
->expects($this->once())
->method('deleteSubAdmin')
->with($targetUser, $targetGroup)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->assertEquals([], $this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom')->getData());
}
@@ -3019,7 +3019,7 @@ public function testGetUserSubAdminGroupsNotExistingTargetUser() {
->expects($this->once())
->method('get')
->with('RequestedUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->getUserSubAdminGroups('RequestedUser');
}
@@ -3030,23 +3030,23 @@ public function testGetUserSubAdminGroupsWithGroups() {
$targetGroup
->expects($this->once())
->method('getGID')
- ->will($this->returnValue('TargetGroup'));
+ ->willReturn('TargetGroup');
$this->userManager
->expects($this->once())
->method('get')
->with('RequestedUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()->getMock();
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
->with($targetUser)
- ->will($this->returnValue([$targetGroup]));
+ ->willReturn([$targetGroup]);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->assertEquals(['TargetGroup'], $this->api->getUserSubAdminGroups('RequestedUser')->getData());
}
@@ -3060,20 +3060,20 @@ public function testEnableUser() {
->expects($this->once())
->method('get')
->with('RequestedUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertEquals([], $this->api->enableUser('RequestedUser')->getData());
}
@@ -3087,20 +3087,20 @@ public function testDisableUser() {
->expects($this->once())
->method('get')
->with('RequestedUser')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertEquals([], $this->api->disableUser('RequestedUser')->getData());
}
@@ -3225,7 +3225,7 @@ public function testResendWelcomeMessageWithNotExistingTargetUser() {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->resendWelcomeMessage('NotExistingUser');
}
@@ -3241,24 +3241,24 @@ public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() {
$loggedInUser
->expects($this->exactly(1))
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('subadmin')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3266,11 +3266,11 @@ public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$this->api->resendWelcomeMessage('UserToGet');
}
@@ -3290,12 +3290,12 @@ public function testResendWelcomeMessageNoEmail() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3303,15 +3303,15 @@ public function testResendWelcomeMessageNoEmail() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('getEmailAddress')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->api->resendWelcomeMessage('UserToGet');
}
@@ -3331,12 +3331,12 @@ public function testResendWelcomeMessageNullEmail() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3344,15 +3344,15 @@ public function testResendWelcomeMessageNullEmail() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('getEmailAddress')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->resendWelcomeMessage('UserToGet');
}
@@ -3370,12 +3370,12 @@ public function testResendWelcomeMessageSuccess() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3383,15 +3383,15 @@ public function testResendWelcomeMessageSuccess() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('getEmailAddress')
- ->will($this->returnValue('abc@example.org'));
+ ->willReturn('abc@example.org');
$emailTemplate = $this->createMock(IEMailTemplate::class);
$this->newUserMailHelper
->expects($this->at(0))
@@ -3418,12 +3418,12 @@ public function testResendWelcomeMessageSuccessWithFallbackLanguage() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3431,15 +3431,15 @@ public function testResendWelcomeMessageSuccessWithFallbackLanguage() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('getEmailAddress')
- ->will($this->returnValue('abc@example.org'));
+ ->willReturn('abc@example.org');
$l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
@@ -3474,12 +3474,12 @@ public function testResendWelcomeMessageFailed() {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->userManager
->expects($this->once())
->method('get')
->with('UserToGet')
- ->will($this->returnValue($targetUser));
+ ->willReturn($targetUser);
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
->disableOriginalConstructor()
->getMock();
@@ -3487,15 +3487,15 @@ public function testResendWelcomeMessageFailed() {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$targetUser
->expects($this->once())
->method('getEmailAddress')
- ->will($this->returnValue('abc@example.org'));
+ ->willReturn('abc@example.org');
$emailTemplate = $this->createMock(IEMailTemplate::class);
$this->newUserMailHelper
->expects($this->at(0))
diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php
index fc30132e6de85..750e242c889a6 100644
--- a/apps/settings/tests/Activity/SecurityFilterTest.php
+++ b/apps/settings/tests/Activity/SecurityFilterTest.php
@@ -62,11 +62,11 @@ public function testGetIcon() {
$this->urlGenerator->expects($this->once())
->method('imagePath')
->with('core', 'actions/password.svg')
- ->will($this->returnValue('path/to/icon.svg'));
+ ->willReturn('path/to/icon.svg');
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with('path/to/icon.svg')
- ->will($this->returnValue('abs/path/to/icon.svg'));
+ ->willReturn('abs/path/to/icon.svg');
$this->assertEquals('abs/path/to/icon.svg', $this->filter->getIcon());
}
@@ -78,7 +78,7 @@ public function testGetName() {
$this->l10n->expects($this->once())
->method('t')
->with('Security')
- ->will($this->returnValue('translated'));
+ ->willReturn('translated');
$this->assertEquals('translated', $this->filter->getName());
}
diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php
index cdb61871dbcd5..da53f8b38e924 100644
--- a/apps/settings/tests/Activity/SecuritySettingTest.php
+++ b/apps/settings/tests/Activity/SecuritySettingTest.php
@@ -59,7 +59,7 @@ public function testGetName() {
$this->l10n->expects($this->once())
->method('t')
->with('Security')
- ->will($this->returnValue('Sicherheit'));
+ ->willReturn('Sicherheit');
$this->assertEquals('Sicherheit', $this->setting->getName());
}
diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php
index 1e386fbaa402a..4e7970027edbf 100644
--- a/apps/settings/tests/Controller/AppSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php
@@ -90,7 +90,7 @@ protected function setUp(): void {
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->config = $this->createMock(IConfig::class);
$this->navigationManager = $this->createMock(INavigationManager::class);
$this->appManager = $this->createMock(IAppManager::class);
@@ -193,7 +193,7 @@ public function testViewApps() {
->expects($this->once())
->method('getSystemValue')
->with('appstoreenabled', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->navigationManager
->expects($this->once())
->method('setActiveEntry')
@@ -227,7 +227,7 @@ public function testViewAppsAppstoreNotEnabled() {
->expects($this->once())
->method('getSystemValue')
->with('appstoreenabled', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->navigationManager
->expects($this->once())
->method('setActiveEntry')
diff --git a/apps/settings/tests/Controller/CertificateControllerTest.php b/apps/settings/tests/Controller/CertificateControllerTest.php
index e5a004b485f65..a04906a6811eb 100644
--- a/apps/settings/tests/Controller/CertificateControllerTest.php
+++ b/apps/settings/tests/Controller/CertificateControllerTest.php
@@ -85,7 +85,7 @@ public function testAddPersonalRootCertificateWithEmptyFile() {
->expects($this->once())
->method('getUploadedFile')
->with('rootcert_import')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$expected = new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY);
$this->assertEquals($expected, $this->certificateController->addPersonalRootCertificate());
@@ -101,53 +101,53 @@ public function testAddPersonalRootCertificateValidCertificate() {
$certificate
->expects($this->once())
->method('getName')
- ->will($this->returnValue('Name'));
+ ->willReturn('Name');
$certificate
->expects($this->once())
->method('getCommonName')
- ->will($this->returnValue('CommonName'));
+ ->willReturn('CommonName');
$certificate
->expects($this->once())
->method('getOrganization')
- ->will($this->returnValue('Organization'));
+ ->willReturn('Organization');
$certificate
->expects($this->exactly(2))
->method('getIssueDate')
- ->will($this->returnValue(new \DateTime('@1429099555')));
+ ->willReturn(new \DateTime('@1429099555'));
$certificate
->expects($this->exactly(2))
->method('getExpireDate')
- ->will($this->returnValue(new \DateTime('@1529099555')));
+ ->willReturn(new \DateTime('@1529099555'));
$certificate
->expects($this->once())
->method('getIssuerName')
- ->will($this->returnValue('Issuer'));
+ ->willReturn('Issuer');
$certificate
->expects($this->once())
->method('getIssuerOrganization')
- ->will($this->returnValue('IssuerOrganization'));
+ ->willReturn('IssuerOrganization');
$this->request
->expects($this->once())
->method('getUploadedFile')
->with('rootcert_import')
- ->will($this->returnValue($uploadedFile));
+ ->willReturn($uploadedFile);
$this->certificateManager
->expects($this->once())
->method('addCertificate')
->with(file_get_contents($uploadedFile['tmp_name'], 'goodCertificate.crt'))
- ->will($this->returnValue($certificate));
+ ->willReturn($certificate);
$this->l10n
->expects($this->at(0))
->method('l')
->with('date', new \DateTime('@1429099555'))
- ->will($this->returnValue('Valid From as String'));
+ ->willReturn('Valid From as String');
$this->l10n
->expects($this->at(1))
->method('l')
->with('date', new \DateTime('@1529099555'))
- ->will($this->returnValue('Valid Till as String'));
+ ->willReturn('Valid Till as String');
$expected = new DataResponse([
@@ -174,7 +174,7 @@ public function testAddPersonalRootCertificateInvalidCertificate() {
->expects($this->once())
->method('getUploadedFile')
->with('rootcert_import')
- ->will($this->returnValue($uploadedFile));
+ ->willReturn($uploadedFile);
$this->certificateManager
->expects($this->once())
->method('addCertificate')
diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php
index 93c781438971f..46769434f4229 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -116,9 +116,9 @@ protected function setUp(): void {
->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($message, array $replace) {
+ ->willReturnCallback(function($message, array $replace) {
return vsprintf($message, $replace);
- }));
+ });
$this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)
->disableOriginalConstructor()->getMock();
$this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
@@ -189,7 +189,7 @@ public function testIsInternetConnectionWorkingDisabledViaConfig() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse(
self::invokePrivate(
@@ -203,12 +203,12 @@ public function testIsInternetConnectionWorkingCorrectly() {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->config->expects($this->at(1))
->method('getSystemValue')
->with('connectivity_check_domains', ['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'])
- ->will($this->returnValue(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']));
+ ->willReturn(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']);
$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
->disableOriginalConstructor()->getMock();
@@ -217,7 +217,7 @@ public function testIsInternetConnectionWorkingCorrectly() {
$this->clientService->expects($this->once())
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertFalse(
@@ -232,12 +232,12 @@ public function testIsInternetConnectionFail() {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->config->expects($this->at(1))
->method('getSystemValue')
->with('connectivity_check_domains', ['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'])
- ->will($this->returnValue(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']));
+ ->willReturn(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']);
$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
->disableOriginalConstructor()->getMock();
@@ -247,7 +247,7 @@ public function testIsInternetConnectionFail() {
$this->clientService->expects($this->exactly(4))
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertTrue(
self::invokePrivate(
@@ -262,7 +262,7 @@ public function testIsMemcacheConfiguredFalse() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('memcache.local', null)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->assertFalse(
self::invokePrivate(
@@ -276,7 +276,7 @@ public function testIsMemcacheConfiguredTrue() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('memcache.local', null)
- ->will($this->returnValue('SomeProvider'));
+ ->willReturn('SomeProvider');
$this->assertTrue(
self::invokePrivate(
@@ -384,19 +384,19 @@ public function testCheck() {
$this->config->expects($this->at(2))
->method('getSystemValue')
->with('connectivity_check_domains', ['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'])
- ->will($this->returnValue(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']));
+ ->willReturn(['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']);
$this->config->expects($this->at(3))
->method('getSystemValue')
->with('memcache.local', null)
- ->will($this->returnValue('SomeProvider'));
+ ->willReturn('SomeProvider');
$this->config->expects($this->at(4))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->config->expects($this->at(5))
->method('getSystemValue')
->with('appstoreenabled', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->request->expects($this->atLeastOnce())
->method('getHeader')
@@ -425,7 +425,7 @@ public function testCheck() {
->will($this->throwException(new \Exception()));
$this->clientService->expects($this->exactly(4))
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->checkSetupController
->expects($this->once())
->method('isPhpOutdated')
@@ -620,11 +620,11 @@ public function testIsPHPMailerUsed() {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('mail_smtpmode', 'smtp')
- ->will($this->returnValue('php'));
+ ->willReturn('php');
$this->config->expects($this->at(1))
->method('getSystemValue')
->with('mail_smtpmode', 'smtp')
- ->will($this->returnValue('not-php'));
+ ->willReturn('not-php');
$this->assertTrue($this->invokePrivate($checkSetupController, 'isPHPMailerUsed'));
$this->assertFalse($this->invokePrivate($checkSetupController, 'isPHPMailerUsed'));
@@ -656,33 +656,33 @@ public function testGetCurlVersion() {
public function testIsUsedTlsLibOutdatedWithAnotherLibrary() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'SSLlib']));
+ ->willReturn(['ssl_version' => 'SSLlib']);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
public function testIsUsedTlsLibOutdatedWithMisbehavingCurl() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
public function testIsUsedTlsLibOutdatedWithOlderOpenSsl() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1c']));
+ ->willReturn(['ssl_version' => 'OpenSSL/1.0.1c']);
$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). Please update your operating system or features such as installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -691,44 +691,44 @@ public function testIsUsedTlsLibOutdatedWithOlderOpenSslAndWithoutAppstore() {
->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1c']));
+ ->willReturn(['ssl_version' => 'OpenSSL/1.0.1c']);
$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.1c). Please update your operating system or features such as Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
public function testIsUsedTlsLibOutdatedWithOlderOpenSsl1() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.2a']));
+ ->willReturn(['ssl_version' => 'OpenSSL/1.0.2a']);
$this->assertSame('cURL is using an outdated OpenSSL version (OpenSSL/1.0.2a). Please update your operating system or features such as installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.1d']));
+ ->willReturn(['ssl_version' => 'OpenSSL/1.0.1d']);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion1() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'OpenSSL/1.0.2b']));
+ ->willReturn(['ssl_version' => 'OpenSSL/1.0.2b']);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -785,11 +785,11 @@ public function testAppDirectoryOwnersNotWritable() {
public function testIsBuggyNss400() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'NSS/1.0.2b']));
+ ->willReturn(['ssl_version' => 'NSS/1.0.2b']);
$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
->disableOriginalConstructor()->getMock();
$exception = $this->getMockBuilder('\GuzzleHttp\Exception\ClientException')
@@ -798,10 +798,10 @@ public function testIsBuggyNss400() {
->disableOriginalConstructor()->getMock();
$response->expects($this->once())
->method('getStatusCode')
- ->will($this->returnValue(400));
+ ->willReturn(400);
$exception->expects($this->once())
->method('getResponse')
- ->will($this->returnValue($response));
+ ->willReturn($response);
$client->expects($this->at(0))
->method('get')
@@ -810,7 +810,7 @@ public function testIsBuggyNss400() {
$this->clientService->expects($this->once())
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertSame('cURL is using an outdated NSS version (NSS/1.0.2b). Please update your operating system or features such as installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -819,11 +819,11 @@ public function testIsBuggyNss400() {
public function testIsBuggyNss200() {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue(['ssl_version' => 'NSS/1.0.2b']));
+ ->willReturn(['ssl_version' => 'NSS/1.0.2b']);
$client = $this->getMockBuilder('\OCP\Http\Client\IClient')
->disableOriginalConstructor()->getMock();
$exception = $this->getMockBuilder('\GuzzleHttp\Exception\ClientException')
@@ -832,10 +832,10 @@ public function testIsBuggyNss200() {
->disableOriginalConstructor()->getMock();
$response->expects($this->once())
->method('getStatusCode')
- ->will($this->returnValue(200));
+ ->willReturn(200);
$exception->expects($this->once())
->method('getResponse')
- ->will($this->returnValue($response));
+ ->willReturn($response);
$client->expects($this->at(0))
->method('get')
@@ -844,7 +844,7 @@ public function testIsBuggyNss200() {
$this->clientService->expects($this->once())
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -854,7 +854,7 @@ public function testIsUsedTlsLibOutdatedWithInternetDisabled() {
->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -863,27 +863,27 @@ public function testIsUsedTlsLibOutdatedWithAppstoreDisabledAndServerToServerSha
->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('appstoreenabled', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->config
->expects($this->at(3))
->method('getAppValue')
->with('files_sharing', 'incoming_server2server_share_enabled', 'yes')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$this->checkSetupController
->expects($this->once())
->method('getCurlVersion')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -892,27 +892,27 @@ public function testIsUsedTlsLibOutdatedWithAppstoreDisabledAndServerToServerSha
->expects($this->at(0))
->method('getSystemValue')
->with('has_internet_connection', true)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('appstoreenabled', true)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->config
->expects($this->at(3))
->method('getAppValue')
->with('files_sharing', 'incoming_server2server_share_enabled', 'yes')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->checkSetupController
->expects($this->never())
->method('getCurlVersion')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -924,7 +924,7 @@ public function testRescanFailedIntegrityCheck() {
->expects($this->once())
->method('linkToRoute')
->with('settings.AdminSettings.index')
- ->will($this->returnValue('/admin'));
+ ->willReturn('/admin');
$expected = new RedirectResponse('/admin');
$this->assertEquals($expected, $this->checkSetupController->rescanFailedIntegrityCheck());
@@ -949,7 +949,7 @@ public function testGetFailedIntegrityCheckFilesWithNoErrorsFound() {
$this->checker
->expects($this->once())
->method('getResults')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$expected = new DataDisplayResponse(
'No errors have been found.',
@@ -969,7 +969,7 @@ public function testGetFailedIntegrityCheckFilesWithSomeErrorsFound() {
$this->checker
->expects($this->once())
->method('getResults')
- ->will($this->returnValue(array ( 'core' => array ( 'EXTRA_FILE' => array('/testfile' => array()), 'INVALID_HASH' => array ( '/.idea/workspace.xml' => array ( 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ), '/lib/private/integritycheck/checker.php' => array ( 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ), '/settings/controller/checksetupcontroller.php' => array ( 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ), ), ), 'bookmarks' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'dav' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'encryption' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'federation' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_antivirus' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_drop' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_pdfviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_sharing' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_trashbin' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_versions' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_videoviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'firstrunwizard' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'gitsmart' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'logreader' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ), ), 'password_policy' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'provisioning_api' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'sketch' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'threatblock' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'two_factor_auth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_ldap' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_shibboleth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), )));
+ ->willReturn(array ( 'core' => array ( 'EXTRA_FILE' => array('/testfile' => array()), 'INVALID_HASH' => array ( '/.idea/workspace.xml' => array ( 'expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094', ), '/lib/private/integritycheck/checker.php' => array ( 'expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585', ), '/settings/controller/checksetupcontroller.php' => array ( 'expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a', ), ), ), 'bookmarks' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'dav' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'encryption' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'federation' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_antivirus' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_drop' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_external' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_pdfviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_sharing' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_trashbin' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_versions' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'files_videoviewer' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'firstrunwizard' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'gitsmart' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'logreader' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.', ), ), 'password_policy' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'provisioning_api' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'sketch' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'threatblock' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'two_factor_auth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_ldap' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), 'user_shibboleth' => array ( 'EXCEPTION' => array ( 'class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.', ), ), ));
$expected = new DataDisplayResponse(
'Technical information
@@ -1390,7 +1390,7 @@ public function dataForIsMysqlUsedWithoutUTF8MB4() {
*/
public function testIsMysqlUsedWithoutUTF8MB4(string $db, bool $useUTF8MB4, bool $expected) {
$this->config->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) use ($db, $useUTF8MB4) {
+ ->willReturnCallback(function($key, $default) use ($db, $useUTF8MB4) {
if ($key === 'dbtype') {
return $db;
}
@@ -1398,7 +1398,7 @@ public function testIsMysqlUsedWithoutUTF8MB4(string $db, bool $useUTF8MB4, bool
return $useUTF8MB4;
}
return $default;
- }));
+ });
$checkSetupController = new CheckSetupController(
'settings',
@@ -1438,7 +1438,7 @@ public function dataForIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed() {
*/
public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $mode, string $className, bool $expected) {
$this->config->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) use ($mode, $className) {
+ ->willReturnCallback(function($key, $default) use ($mode, $className) {
if ($key === 'objectstore' && $mode === 'singlebucket') {
return ['class' => $className];
}
@@ -1446,7 +1446,7 @@ public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $m
return ['class' => $className];
}
return $default;
- }));
+ });
$checkSetupController = new CheckSetupController(
'settings',
diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php
index 331e6283544c1..f09960450068b 100644
--- a/apps/settings/tests/Controller/MailSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php
@@ -153,10 +153,10 @@ public function testSendTestMail() {
$user = $this->createMock(User::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('Werner'));
+ ->willReturn('Werner');
$user->expects($this->any())
->method('getDisplayName')
- ->will($this->returnValue('Werner Brösel'));
+ ->willReturn('Werner Brösel');
$this->l->expects($this->any())
->method('t')
@@ -166,7 +166,7 @@ public function testSendTestMail() {
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
// Ensure that it fails when no mail address has been specified
$response = $this->mailController->sendTestMail();
@@ -177,7 +177,7 @@ public function testSendTestMail() {
$this->config
->expects($this->any())
->method('getUserValue')
- ->will($this->returnValue('mail@example.invalid'));
+ ->willReturn('mail@example.invalid');
$this->mailer->expects($this->once())
->method('createMessage')
->willReturn($this->createMock(Message::class));
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 5c494d12fecdb..9253c9d7d2ea4 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -107,9 +107,9 @@ protected function setUp(): void {
$this->encryptionManager = $this->createMock(IManager::class);
$this->l->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->encryptionModule = $this->createMock(IEncryptionModule::class);
$this->encryptionManager->expects($this->any())->method('getEncryptionModules')
diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php
index a6371c37a9225..35700245c84b1 100644
--- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php
+++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php
@@ -84,7 +84,7 @@ protected function setUp(): void {
[]
);
$this->mailer->method('createEMailTemplate')
- ->will($this->returnValue($template));
+ ->willReturn($template);
$this->secureRandom = $this->createMock(ISecureRandom::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(IConfig::class);
@@ -102,13 +102,13 @@ protected function setUp(): void {
});
$this->crypto = $this->createMock(ICrypto::class);
$this->l10n->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->l10nFactory->method('get')
- ->will($this->returnCallback(function ($text, $lang) {
+ ->willReturnCallback(function ($text, $lang) {
return $this->l10n;
- }));
+ });
$this->newUserMailHelper = new \OCA\Settings\Mailer\NewUserMailHelper(
$this->defaults,
diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
index 4b48ec74b81ba..8b40f002c3209 100644
--- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
+++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
@@ -72,7 +72,7 @@ public function testBeforeControllerAsUserWithExemption() {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->subadminMiddleware->beforeController($this->controller, 'foo');
}
@@ -82,7 +82,7 @@ public function testBeforeControllerAsUserWithoutExemption() {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->subadminMiddleware->beforeController($this->controller, 'foo');
}
@@ -91,7 +91,7 @@ public function testBeforeControllerAsSubAdminWithoutExemption() {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
@@ -100,7 +100,7 @@ public function testBeforeControllerAsSubAdminWithExemption() {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php
index 07bba57a19cf0..cc3c4604283db 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -113,9 +113,9 @@ protected function setUp(): void {
$this->l = $this->getMockBuilder(IL10N::class)->getMock();
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
$this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 8c5f111acee56..d6f8ff4c6b0a0 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -153,9 +153,9 @@ public function testUpdateStylesheetSuccess($setting, $value, $message) {
$this->l10n
->expects($this->once())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
@@ -212,9 +212,9 @@ public function testUpdateStylesheetError($setting, $value, $message) {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -243,9 +243,9 @@ public function testUpdateLogoNoData() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -291,9 +291,9 @@ public function testUploadSVGFaviconWithoutImagemagick() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
@@ -335,9 +335,9 @@ public function testUpdateLogoInvalidMimeType() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
@@ -396,9 +396,9 @@ public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists=true) {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$file = $this->createMock(ISimpleFile::class);
@@ -472,9 +472,9 @@ public function testUpdateLogoLoginScreenUpload($folderExists) {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -546,9 +546,9 @@ public function testUpdateLogoLoginScreenUploadWithInvalidImage() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
@@ -604,9 +604,9 @@ public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $e
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -643,9 +643,9 @@ public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErro
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
diff --git a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php
index 136a734aa81e0..89cd88e05e354 100644
--- a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php
+++ b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php
@@ -84,7 +84,7 @@ public function testGetBackupCodes() {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue($this->testUID));
+ ->willReturn($this->testUID);
$dbCodes = $this->mapper->getBackupCodes($user);
@@ -101,7 +101,7 @@ public function testDeleteCodes() {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue($this->testUID));
+ ->willReturn($this->testUID);
$this->mapper->insert($code);
diff --git a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
index 342ab35b0ead3..8cd20df85a7ec 100644
--- a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
+++ b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
@@ -59,7 +59,7 @@ public function testSimpleWorkFlow() {
$user = $this->getMockBuilder(\OCP\IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue($this->testUID));
+ ->willReturn($this->testUID);
$this->notificationManager->expects($this->once())
->method('markProcessed')
diff --git a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php
index bd0062e826b62..141e6d132027f 100644
--- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php
@@ -68,9 +68,9 @@ protected function setUp(): void {
$this->user = $this->createMock(IUser::class);
$this->userManager->method('callForSeenUsers')
- ->will($this->returnCallback(function(\Closure $e) {
+ ->willReturnCallback(function(\Closure $e) {
$e($this->user);
- }));
+ });
$this->checkBackupCodes = new CheckBackupCodes(
$this->createMock(ITimeFactory::class),
diff --git a/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php b/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php
index 0f4b12eae5fd0..95d94e4fc0df0 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php
@@ -65,15 +65,15 @@ public function testCreateCodes() {
$codes = ['a', 'b'];
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->storage->expects($this->once())
->method('createCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->storage->expects($this->once())
->method('getBackupCodesState')
->with($user)
- ->will($this->returnValue('state'));
+ ->willReturn('state');
$expected = [
'codes' => $codes,
diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php
index 5a5b3a6d29aeb..2aec2e72d9473 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php
@@ -73,26 +73,26 @@ public function testHandleCodesGeneratedEvent() {
$activityEvent = $this->createMock(IEvent::class);
$this->activityManager->expects($this->once())
->method('generateEvent')
- ->will($this->returnValue($activityEvent));
+ ->willReturn($activityEvent);
$activityEvent->expects($this->once())
->method('setApp')
->with('twofactor_backupcodes')
- ->will($this->returnSelf());
+ ->willReturnSelf();
$activityEvent->expects($this->once())
->method('setType')
->with('security')
- ->will($this->returnSelf());
+ ->willReturnSelf();
$activityEvent->expects($this->once())
->method('setAuthor')
->with('fritz')
- ->will($this->returnSelf());
+ ->willReturnSelf();
$activityEvent->expects($this->once())
->method('setAffectedUser')
->with('fritz')
- ->will($this->returnSelf());
+ ->willReturnSelf();
$this->activityManager->expects($this->once())
->method('publish')
- ->will($this->returnValue($activityEvent));
+ ->willReturn($activityEvent);
$this->listener->handle($event);
}
diff --git a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php
index 194e9dc6e0547..2ade2046e75bd 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php
@@ -74,7 +74,7 @@ public function testGetDisplayName() {
$this->l10n->expects($this->once())
->method('t')
->with('Backup code')
- ->will($this->returnValue('l10n backup code'));
+ ->willReturn('l10n backup code');
$this->assertSame('l10n backup code', $this->provider->getDisplayName());
}
@@ -82,7 +82,7 @@ public function testGetDescription() {
$this->l10n->expects($this->once())
->method('t')
->with('Use backup code')
- ->will($this->returnValue('l10n use backup code'));
+ ->willReturn('l10n use backup code');
$this->assertSame('l10n use backup code', $this->provider->getDescription());
}
@@ -100,7 +100,7 @@ public function testVerfiyChallenge() {
$this->storage->expects($this->once())
->method('validateCode')
->with($user, $challenge)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->provider->verifyChallenge($user, $challenge));
}
@@ -111,7 +111,7 @@ public function testIsTwoFactorEnabledForUser() {
$this->storage->expects($this->once())
->method('hasBackupCodes')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($this->provider->isTwoFactorAuthEnabledForUser($user));
}
diff --git a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php
index a2bd743c17cec..ab895f4d854e1 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php
@@ -70,11 +70,11 @@ public function testCreateCodes() {
$this->random->expects($this->exactly($number))
->method('generate')
->with(16, ISecureRandom::CHAR_HUMAN_READABLE)
- ->will($this->returnValue('CODEABCDEF'));
+ ->willReturn('CODEABCDEF');
$this->hasher->expects($this->exactly($number))
->method('hash')
->with('CODEABCDEF')
- ->will($this->returnValue('HASHEDCODE'));
+ ->willReturn('HASHEDCODE');
$row = new BackupCode();
$row->setUserId('fritz');
$row->setCode('HASHEDCODE');
@@ -106,7 +106,7 @@ public function testHasBackupCodes() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->assertTrue($this->storage->hasBackupCodes($user));
}
@@ -118,7 +118,7 @@ public function testHasBackupCodesNoCodes() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->assertFalse($this->storage->hasBackupCodes($user));
}
@@ -138,7 +138,7 @@ public function testGetBackupCodeState() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$expected = [
'enabled' => true,
@@ -156,7 +156,7 @@ public function testGetBackupCodeDisabled() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$expected = [
'enabled' => false,
@@ -178,11 +178,11 @@ public function testValidateCode() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->hasher->expects($this->once())
->method('verify')
->with('CHALLENGE', 'HASHEDVALUE', $this->anything())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->mapper->expects($this->once())
->method('update')
->with($code);
@@ -204,7 +204,7 @@ public function testValidateUsedCode() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->hasher->expects($this->never())
->method('verify');
$this->mapper->expects($this->never())
@@ -225,11 +225,11 @@ public function testValidateCodeWithWrongHash() {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$this->hasher->expects($this->once())
->method('verify')
->with('CHALLENGE', 'HASHEDVALUE')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->mapper->expects($this->never())
->method('update');
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 012a6831eb4b2..e8fa47c6ab991 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -187,7 +187,7 @@ public function testGetDomainDNFromDNSuccess() {
$this->ldap->expects($this->once())
->method('explodeDN')
->with($inputDN, 0)
- ->will($this->returnValue(explode(',', $inputDN)));
+ ->willReturn(explode(',', $inputDN));
$this->assertSame($domainDN, $this->access->getDomainDNFromDN($inputDN));
}
@@ -199,7 +199,7 @@ public function testGetDomainDNFromDNError() {
$this->ldap->expects($this->once())
->method('explodeDN')
->with($inputDN, 0)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertSame($expected, $this->access->getDomainDNFromDN($inputDN));
}
@@ -236,12 +236,12 @@ public function testStringResemblesDN($case) {
$lw->expects($this->exactly(1))
->method('explodeDN')
- ->will($this->returnCallback(function ($dn) use ($case) {
+ ->willReturnCallback(function ($dn) use ($case) {
if($dn === $case['input']) {
return $case['interResult'];
}
return null;
- }));
+ });
$this->assertSame($case['expectedResult'], $access->stringResemblesDN($case['input']));
}
@@ -294,7 +294,7 @@ public function testBatchApplyUserAttributes() {
// also returns for userUuidAttribute
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -319,7 +319,7 @@ public function testBatchApplyUserAttributes() {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -329,13 +329,13 @@ public function testBatchApplyUserAttributesSkipped() {
$mapperMock = $this->createMock(UserMapping::class);
$mapperMock->expects($this->any())
->method('getNameByDN')
- ->will($this->returnValue('a_username'));
+ ->willReturn('a_username');
$userMock = $this->createMock(User::class);
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -370,13 +370,13 @@ public function testBatchApplyUserAttributesDontSkip() {
$mapperMock = $this->createMock(UserMapping::class);
$mapperMock->expects($this->any())
->method('getNameByDN')
- ->will($this->returnValue('a_username'));
+ ->willReturn('a_username');
$userMock = $this->createMock(User::class);
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -401,7 +401,7 @@ public function testBatchApplyUserAttributesDontSkip() {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -429,12 +429,12 @@ public function testSanitizeDN($attribute) {
$lw->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$lw->expects($this->any())
->method('getAttributes')
- ->will($this->returnValue(array(
+ ->willReturn(array(
$attribute => array('count' => 1, $dnFromServer)
- )));
+ ));
$access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager);
$values = $access->readAttribute('uid=whoever,dc=example,dc=org', $attribute);
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index 269215924058f..82e6f85952d09 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -57,7 +57,7 @@ protected function setUp(): void {
$this->ldap->expects($this->any())
->method('areLDAPFunctionsAvailable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
}
public function testOriginalAgentUnchangedOnClone() {
@@ -105,19 +105,19 @@ public function testUseBackupServer() {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->exactly(3))
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0));
+ ->willReturn(0);
// Not called often enough? Then, the fallback to the backup server is broken.
$this->connection->expects($this->exactly(4))
@@ -132,13 +132,13 @@ public function testUseBackupServer() {
$isThrown = false;
$this->ldap->expects($this->exactly(3))
->method('bind')
- ->will($this->returnCallback(function () use (&$isThrown) {
+ ->willReturnCallback(function () use (&$isThrown) {
if(!$isThrown) {
$isThrown = true;
throw new \OC\ServerNotAvailableException();
}
return true;
- }));
+ });
$this->connection->init();
$this->connection->resetConnectionResource();
@@ -164,19 +164,19 @@ public function testDontUseBackupServerOnFailedAuth() {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->once())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(49));
+ ->willReturn(49);
$this->connection->expects($this->any())
->method('getFromCache')
@@ -212,24 +212,24 @@ public function testBindWithInvalidCredentials() {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->once())
->method('bind')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// LDAP_INVALID_CREDENTIALS
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0x31));
+ ->willReturn(0x31);
try {
$this->assertFalse($this->connection->bind(), 'Connection::bind() should not return true with invalid credentials.');
@@ -259,27 +259,27 @@ public function testStartTlsNegotiationFailure() {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('bind')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->ldap->expects($this->any())
->method('startTls')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->expectException(\OC\ServerNotAvailableException::class);
$this->expectExceptionMessage('Start TLS failed, when connecting to LDAP host ' . $host . '.');
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 7ea4cb463d96f..5fdc3c5862c6c 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -70,7 +70,7 @@ private function getAccessMock() {
$access->expects($this->any())
->method('getConnection')
- ->will($this->returnValue($connector));
+ ->willReturn($connector);
return $access;
}
@@ -87,12 +87,12 @@ private function enableGroups($access) {
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
- }));
+ });
}
public function testCountEmptySearchString() {
@@ -104,7 +104,7 @@ public function testCountEmptySearchString() {
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue($groupDN));
+ ->willReturn($groupDN);
$access->expects($this->any())
->method('readAttribute')
@@ -123,7 +123,7 @@ public function testCountEmptySearchString() {
// for primary groups
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(2));
+ ->willReturn(2);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('group');
@@ -139,15 +139,15 @@ public function testCountWithSearchString() {
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=group,dc=foo,dc=bar'));
+ ->willReturn('cn=group,dc=foo,dc=bar');
$access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
//the search operation will call readAttribute, thus we need
//to anaylze the "dn". All other times we just need to return
//something that is neither null or false, but once an array
@@ -157,13 +157,13 @@ public function testCountWithSearchString() {
return strpos($name, '3');
}
return ['u11', 'u22', 'u33', 'u34'];
- }));
+ });
$access->expects($this->any())
->method('dn2username')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return 'foobar' . \OC::$server->getSecureRandom()->generate(7);
- }));
+ });
$groupBackend = new GroupLDAP($access,$pluginManager);
$users = $groupBackend->countUsersInGroup('group', '3');
@@ -205,12 +205,12 @@ public function testGidNumber2NameSuccess() {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
->with('cn=foo,dc=barfoo,dc=bar')
- ->will($this->returnValue('MyGroup'));
+ ->willReturn('MyGroup');
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -229,7 +229,7 @@ public function testGidNumberID2NameNoGroup() {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$access->expects($this->never())
->method('dn2groupname');
@@ -251,11 +251,11 @@ public function testGidNumberID2NameNoName() {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -276,7 +276,7 @@ public function testGetEntryGidNumberValue() {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(array('3117')));
+ ->willReturn(array('3117'));
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -297,7 +297,7 @@ public function testGetEntryGidNumberNoValue() {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -317,16 +317,16 @@ public function testPrimaryGroupID2NameSuccess() {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
->with('cn=foo,dc=barfoo,dc=bar')
- ->will($this->returnValue('MyGroup'));
+ ->willReturn('MyGroup');
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -346,7 +346,7 @@ public function testPrimaryGroupID2NameNoSID() {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$access->expects($this->never())
->method('searchGroups');
@@ -372,11 +372,11 @@ public function testPrimaryGroupID2NameNoGroup() {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$access->expects($this->never())
->method('dn2groupname');
@@ -399,15 +399,15 @@ public function testPrimaryGroupID2NameNoName() {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -430,7 +430,7 @@ public function testGetEntryGroupIDValue() {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(array('3117')));
+ ->willReturn(array('3117'));
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -453,7 +453,7 @@ public function testGetEntryGroupIDNoValue() {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -479,7 +479,7 @@ public function testInGroupHitsUidGidCache() {
$access->connection->expects($this->once())
->method('getFromCache')
->with($cacheKey)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$access->expects($this->never())
->method('username2dn');
@@ -496,7 +496,7 @@ public function testGetGroupsWithOffset() {
$access->expects($this->once())
->method('nextcloudGroupNames')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$groupBackend = new GroupLDAP($access, $pluginManager);
$groups = $groupBackend->getGroups('', 2, 2);
@@ -516,20 +516,20 @@ public function testUsersInGroupPrimaryMembersOnly() {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
} else if($attr === 'gidNumber') {
return [4211];
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->exactly(2))
->method('nextcloudUserNames')
->willReturnOnConsecutiveCalls(['lisa', 'bart', 'kira', 'brad'], ['walle', 'dino', 'xenia']);
@@ -553,21 +553,21 @@ public function testUsersInGroupPrimaryAndUnixMembers() {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->once())
->method('nextcloudUserNames')
- ->will($this->returnValue(array('lisa', 'bart', 'kira', 'brad')));
+ ->willReturn(array('lisa', 'bart', 'kira', 'brad'));
$access->userManager = $this->createMock(Manager::class);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -588,24 +588,24 @@ public function testCountUsersInGroupPrimaryMembersOnly() {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(4));
+ ->willReturn(4);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('foobar');
@@ -626,7 +626,7 @@ public function testGetUserGroupsMemberOf() {
$access->expects($this->any())
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->exactly(3))
->method('readAttribute')
@@ -634,11 +634,11 @@ public function testGetUserGroupsMemberOf() {
$access->expects($this->exactly(2))
->method('dn2groupname')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$access->expects($this->exactly(1))
->method('groupsMatchFilter')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$groupBackend = new GroupLDAP($access, $pluginManager);
$groups = $groupBackend->getUserGroups('userX');
@@ -653,14 +653,14 @@ public function testGetUserGroupsMemberOfDisabled() {
$access->connection = $this->createMock(Connection::class);
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'useMemberOfToDetectMembership') {
return 0;
} else if($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
- }));
+ });
$dn = 'cn=userX,dc=foobar';
@@ -669,13 +669,13 @@ public function testGetUserGroupsMemberOfDisabled() {
$access->expects($this->once())
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->never())
->method('readAttribute')
->with($dn, 'memberOf');
$access->expects($this->once())
->method('nextcloudGroupNames')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$access->expects($this->any())
->method('groupsMatchFilter')
->willReturnArgument(0);
@@ -691,7 +691,7 @@ public function testGetGroupsByMember() {
$access->connection = $this->createMock(Connection::class);
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
switch($name) {
case 'useMemberOfToDetectMembership':
return 0;
@@ -703,7 +703,7 @@ public function testGetGroupsByMember() {
return 'member';
}
return 1;
- }));
+ });
$dn = 'cn=userX,dc=foobar';
@@ -712,7 +712,7 @@ public function testGetGroupsByMember() {
$access->expects($this->exactly(2))
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->never())
->method('readAttribute')
@@ -730,10 +730,10 @@ public function testGetGroupsByMember() {
$access->expects($this->once())
->method('nextcloudGroupNames')
->with([$group1, $group2])
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$access->expects($this->once())
->method('fetchListOfGroups')
- ->will($this->returnValue([$group1, $group2]));
+ ->willReturn([$group1, $group2]);
$access->expects($this->any())
->method('groupsMatchFilter')
->willReturnArgument(0);
@@ -816,7 +816,7 @@ public function testDeleteGroupWithPlugin() {
$access = $this->getAccessMock();
$access->expects($this->any())
->method('getGroupMapper')
- ->will($this->returnValue($mapper));
+ ->willReturn($mapper);
$access->connection = $this->createMock(Connection::class);
diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php
index af4d24739bec4..a9b889dbc5550 100644
--- a/apps/user_ldap/tests/HelperTest.php
+++ b/apps/user_ldap/tests/HelperTest.php
@@ -67,7 +67,7 @@ public function testGetServerConfigurationPrefixesActive() {
]);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) {
+ ->willReturnCallback(function($app, $key, $default) {
if ($app !== 'user_ldap') {
$this->fail('wrong app');
}
@@ -75,7 +75,7 @@ public function testGetServerConfigurationPrefixesActive() {
return '1';
}
return $default;
- }));
+ });
$result = $this->helper->getServerConfigurationPrefixes(true);
@@ -93,7 +93,7 @@ public function testGetServerConfigurationHost() {
]);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) {
+ ->willReturnCallback(function($app, $key, $default) {
if ($app !== 'user_ldap') {
$this->fail('wrong app');
}
@@ -104,7 +104,7 @@ public function testGetServerConfigurationHost() {
return 'foo.bar.com';
}
return $default;
- }));
+ });
$result = $this->helper->getServerConfigurationHosts();
diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php
index 2d8ab25425719..22065d14b2ce3 100644
--- a/apps/user_ldap/tests/Jobs/CleanUpTest.php
+++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php
@@ -54,7 +54,7 @@ public function test_runNotAllowedByDisabledConfigurations() {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(true) );
+ ->willReturn(true );
$args['ocConfig']->expects($this->never())
->method('getSystemValue');
@@ -93,11 +93,11 @@ public function test_runNotAllowedBySysConfig() {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$args['ocConfig']->expects($this->once())
->method('getSystemValue')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$bgJob = new \OCA\User_LDAP\Jobs\CleanUp();
$bgJob->setArguments($args);
@@ -113,11 +113,11 @@ public function test_runIsAllowed() {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$args['ocConfig']->expects($this->once())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$bgJob = new \OCA\User_LDAP\Jobs\CleanUp();
$bgJob->setArguments($args);
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index 784719c3b900e..ad73d096efdfb 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -104,7 +104,7 @@ protected function setUp(): void {
$this->access->expects($this->any())
->method('getConnection')
- ->will($this->returnValue($this->connection));
+ ->willReturn($this->connection);
/** @noinspection PhpUnhandledExceptionInspection */
$this->manager = new Manager(
@@ -138,11 +138,11 @@ public function testGetByDNExisting(string $inputDN) {
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('dn2username')
->with($this->equalTo($inputDN))
- ->will($this->returnValue($uid));
+ ->willReturn($uid);
$this->access->expects($this->never())
->method('username2dn');
@@ -163,15 +163,15 @@ public function testGetByDNNotExisting() {
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('dn2username')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->access->expects($this->once())
->method('username2dn')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$user = $this->manager->get($inputDN);
@@ -188,11 +188,11 @@ public function testGetByUidExisting() {
$this->access->expects($this->once())
->method('username2dn')
->with($this->equalTo($uid))
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($uid))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$this->manager->get($uid);
@@ -213,7 +213,7 @@ public function testGetByUidNotExisting() {
$this->access->expects($this->exactly(1))
->method('username2dn')
->with($this->equalTo($uid))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$user = $this->manager->get($uid);
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 36a312172c1ef..cb9df7037b986 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -118,13 +118,13 @@ public function testUpdateEmailProvided() {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue('email'));
+ ->willReturn('email');
$this->access->expects($this->once())
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('email'))
- ->will($this->returnValue(['alice@foo.bar']));
+ ->willReturn(['alice@foo.bar']);
$coreUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
@@ -144,13 +144,13 @@ public function testUpdateEmailNotProvided() {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue('email'));
+ ->willReturn('email');
$this->access->expects($this->once())
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('email'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config->expects($this->never())
->method('setUserValue');
@@ -162,7 +162,7 @@ public function testUpdateEmailNotConfigured() {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->access->expects($this->never())
->method('readAttribute');
@@ -185,7 +185,7 @@ public function testUpdateQuotaAllProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['42 GB']));
+ ->willReturn(['42 GB']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -195,7 +195,7 @@ public function testUpdateQuotaAllProvided() {
$this->userManager->expects($this->atLeastOnce())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -212,7 +212,7 @@ public function testUpdateQuotaToDefaultAllProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['default']));
+ ->willReturn(['default']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -222,7 +222,7 @@ public function testUpdateQuotaToDefaultAllProvided() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -239,7 +239,7 @@ public function testUpdateQuotaToNoneAllProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['none']));
+ ->willReturn(['none']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -249,7 +249,7 @@ public function testUpdateQuotaToNoneAllProvided() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -258,11 +258,11 @@ public function testUpdateQuotaDefaultProvided() {
$this->connection->expects($this->at(0))
->method('__get')
->with($this->equalTo('ldapQuotaAttribute'))
- ->will($this->returnValue('myquota'));
+ ->willReturn('myquota');
$this->connection->expects($this->at(1))
->method('__get')
->with($this->equalTo('ldapQuotaDefault'))
- ->will($this->returnValue('25 GB'));
+ ->willReturn('25 GB');
$this->connection->expects($this->exactly(2))
->method('__get');
@@ -270,7 +270,7 @@ public function testUpdateQuotaDefaultProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -280,7 +280,7 @@ public function testUpdateQuotaDefaultProvided() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -297,7 +297,7 @@ public function testUpdateQuotaIndividualProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['27 GB']));
+ ->willReturn(['27 GB']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -307,7 +307,7 @@ public function testUpdateQuotaIndividualProvided() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -324,7 +324,7 @@ public function testUpdateQuotaNoneProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -385,7 +385,7 @@ public function testUpdateQuotaFromValue() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->user->updateQuota($readQuota);
}
@@ -405,7 +405,7 @@ public function testUpdateWrongQuotaAllProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['42 GBwos']));
+ ->willReturn(['42 GBwos']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -415,7 +415,7 @@ public function testUpdateWrongQuotaAllProvided() {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -435,7 +435,7 @@ public function testUpdateWrongDefaultQuotaProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -462,7 +462,7 @@ public function testUpdateWrongQuotaAndDefaultAllProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['23 flush']));
+ ->willReturn(['23 flush']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -504,26 +504,26 @@ public function XtestUpdateAvatarJpegPhotoProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->image->expects($this->once())
->method('loadFromBase64')
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -535,7 +535,7 @@ public function XtestUpdateAvatarJpegPhotoProvided() {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -545,7 +545,7 @@ public function XtestUpdateAvatarJpegPhotoProvided() {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -560,7 +560,7 @@ public function testUpdateAvatarKnownJpegPhotoProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->image->expects($this->once())
->method('loadFromBase64')
@@ -575,7 +575,7 @@ public function testUpdateAvatarKnownJpegPhotoProvided() {
->method('centerCrop');
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -623,19 +623,19 @@ public function XtestUpdateAvatarThumbnailPhotoProvided() {
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -647,7 +647,7 @@ public function XtestUpdateAvatarThumbnailPhotoProvided() {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -657,7 +657,7 @@ public function XtestUpdateAvatarThumbnailPhotoProvided() {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -741,19 +741,19 @@ public function XtestUpdateAvatarUnsupportedThumbnailPhotoProvided() {
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -764,7 +764,7 @@ public function XtestUpdateAvatarUnsupportedThumbnailPhotoProvided() {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -775,7 +775,7 @@ public function XtestUpdateAvatarUnsupportedThumbnailPhotoProvided() {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -837,13 +837,13 @@ public function testUpdateBeforeFirstLogin() {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->never())
@@ -858,13 +858,13 @@ public function testUpdateAfterFirstLogin() {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(1));
+ ->willReturn(1);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->once())
@@ -872,7 +872,7 @@ public function testUpdateAfterFirstLogin() {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->anything())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -932,19 +932,19 @@ public function testUpdateNoRefresh() {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(1));
+ ->willReturn(1);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(time() - 10));
+ ->willReturn(time() - 10);
$this->config->expects($this->once())
->method('getAppValue')
->with($this->equalTo('user_ldap'),
$this->equalTo('updateAttributesInterval'),
$this->anything())
- ->will($this->returnValue(1800));
+ ->willReturn(1800);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->never())
@@ -960,7 +960,7 @@ public function testMarkLogin() {
$this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(1))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->user->markLogin();
}
@@ -970,7 +970,7 @@ public function testGetAvatarImageProvided() {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->connection->expects($this->any())
->method('resolveRule')
->with('avatar')
@@ -1037,12 +1037,12 @@ public function testProcessAttributes() {
));
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:homeDirectory';
}
return $name;
- }));
+ });
$this->connection->expects($this->any())
->method('resolveRule')
->with('avatar')
@@ -1083,7 +1083,7 @@ public function testGetHomePathNotConfigured($attributeValue) {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue($attributeValue));
+ ->willReturn($attributeValue);
$this->access->expects($this->never())
->method('readAttribute');
@@ -1099,16 +1099,16 @@ public function testGetHomePathConfiguredNotAvailableAllowed() {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue('attr:foobar'));
+ ->willReturn('attr:foobar');
$this->access->expects($this->once())
->method('readAttribute')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// asks for "enforce_home_folder_naming_rule"
$this->config->expects($this->once())
->method('getAppValue')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$this->assertFalse($this->user->getHomePath());
@@ -1121,16 +1121,16 @@ public function testGetHomePathConfiguredNotAvailableNotAllowed() {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue('attr:foobar'));
+ ->willReturn('attr:foobar');
$this->access->expects($this->once())
->method('readAttribute')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// asks for "enforce_home_folder_naming_rule"
$this->config->expects($this->once())
->method('getAppValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->user->getHomePath();
}
@@ -1192,7 +1192,7 @@ public function testComposeAndStoreDisplayNameNoOverwrite() {
public function testHandlePasswordExpiryWarningDefaultPolicy() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
@@ -1200,11 +1200,11 @@ public function testHandlePasswordExpiryWarningDefaultPolicy() {
return '1';
}
return $name;
- }));
+ });
$this->access->expects($this->any())
->method('search')
- ->will($this->returnCallback(function($filter, $base) {
+ ->willReturnCallback(function($filter, $base) {
if($base === [$this->dn]) {
return [
[
@@ -1222,27 +1222,27 @@ public function testHandlePasswordExpiryWarningDefaultPolicy() {
];
}
return [];
- }));
+ });
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
->method('setApp')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setUser')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setObject')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setDateTime')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(2))
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(1))
->method('notify');
@@ -1255,7 +1255,7 @@ public function testHandlePasswordExpiryWarningDefaultPolicy() {
public function testHandlePasswordExpiryWarningCustomPolicy() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
@@ -1263,11 +1263,11 @@ public function testHandlePasswordExpiryWarningCustomPolicy() {
return '1';
}
return $name;
- }));
+ });
$this->access->expects($this->any())
->method('search')
- ->will($this->returnCallback(function($filter, $base) {
+ ->willReturnCallback(function($filter, $base) {
if($base === [$this->dn]) {
return [
[
@@ -1286,27 +1286,27 @@ public function testHandlePasswordExpiryWarningCustomPolicy() {
];
}
return [];
- }));
+ });
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
->method('setApp')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setUser')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setObject')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setDateTime')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(2))
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(1))
->method('notify');
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index e4a105b2bd64d..f3052b1932748 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -107,7 +107,7 @@ protected function setUp(): void {
private function prepareMockForUserExists() {
$this->access->expects($this->any())
->method('username2dn')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch ($uid) {
case 'gunslinger':
return 'dnOfRoland,dc=test';
@@ -124,7 +124,7 @@ private function prepareMockForUserExists() {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
@@ -138,29 +138,29 @@ private function prepareMockForUserExists() {
private function prepareAccessForCheckPassword($noDisplayName = false) {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapLoginFilter') {
return '%uid';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($filter) {
+ ->willReturnCallback(function($filter) {
if($filter === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$retVal = 'gunslinger';
if($noDisplayName === true) {
@@ -169,19 +169,19 @@ private function prepareAccessForCheckPassword($noDisplayName = false) {
$this->access->expects($this->any())
->method('dn2username')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue($retVal));
+ ->willReturn($retVal);
$this->access->expects($this->any())
->method('stringResemblesDN')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->any())
->method('areCredentialsValid')
- ->will($this->returnCallback(function($dn, $pwd) {
+ ->willReturnCallback(function($dn, $pwd) {
if($pwd === 'dt19') {
return true;
}
return false;
- }));
+ });
}
public function testCheckPasswordUidReturn() {
@@ -297,10 +297,10 @@ public function testDeleteUserSuccess() {
$mapping = $this->createMock(UserMapping::class);
$mapping->expects($this->once())
->method('unmap')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('getUserMapper')
- ->will($this->returnValue($mapping));
+ ->willReturn($mapping);
$this->connection->expects($this->any())
->method('getConnectionResource')
->willReturn('this is an ldap link');
@@ -362,22 +362,22 @@ public function testDeleteUserWithPlugin() {
private function prepareAccessForGetUsers() {
$this->access->expects($this->once())
->method('escapeFilterPart')
- ->will($this->returnCallback(function($search) {
+ ->willReturnCallback(function($search) {
return $search;
- }));
+ });
$this->access->expects($this->any())
->method('getFilterPartForUserSearch')
- ->will($this->returnCallback(function($search) {
+ ->willReturnCallback(function($search) {
return $search;
- }));
+ });
$this->access->expects($this->any())
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function($param) {
+ ->willReturnCallback(function($param) {
return $param[2];
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($search, $a, $l, $o) {
+ ->willReturnCallback(function($search, $a, $l, $o) {
$users = array('gunslinger', 'newyorker', 'ladyofshadows');
if(empty($search)) {
$result = $users;
@@ -393,10 +393,10 @@ private function prepareAccessForGetUsers() {
$result = array_slice($result, $o, $l);
}
return $result;
- }));
+ });
$this->access->expects($this->any())
->method('nextcloudUserNames')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
}
@@ -543,12 +543,12 @@ public function testUserExistsForNeverExisting() {
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn) {
+ ->willReturnCallback(function($dn) {
if($dn === 'dnOfRoland,dc=test') {
return array();
}
return false;
- }));
+ });
//test for never-existing user
/** @noinspection PhpUnhandledExceptionInspection */
@@ -568,12 +568,12 @@ public function testUserExistsPublicAPI() {
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn) {
+ ->willReturnCallback(function($dn) {
if($dn === 'dnOfRoland,dc=test') {
return array();
}
return false;
- }));
+ });
$this->userManager->expects($this->atLeastOnce())
->method('get')
->willReturn($user);
@@ -600,16 +600,16 @@ public function testGetHomeAbsolutePath() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfRoland,dc=test':
if($attr === 'testAttribute') {
@@ -620,7 +620,7 @@ public function testGetHomeAbsolutePath() {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -652,16 +652,16 @@ public function testGetHomeRelative() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfLadyOfShadows,dc=test':
if($attr === 'testAttribute') {
@@ -672,7 +672,7 @@ public function testGetHomeRelative() {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -703,20 +703,20 @@ public function testGetHomeNoPath() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
default:
return false;
}
- }));
+ });
$this->access->connection->expects($this->any())
->method('getFromCache')
->willReturnCallback(function($key) {
@@ -751,26 +751,26 @@ public function testGetHomeDeletedUser() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$userMapper = $this->createMock(UserMapping::class);
$this->access->expects($this->any())
->method('getUserMapper')
- ->will($this->returnValue($userMapper));
+ ->willReturn($userMapper);
$this->config->expects($this->any())
->method('getUserValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$offlineUser = $this->createMock(OfflineUser::class);
$offlineUser->expects($this->atLeastOnce())
@@ -797,9 +797,9 @@ public function testGetHomeWithPlugin() {
$this->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
return true;
- }));
+ });
/** @noinspection PhpUnhandledExceptionInspection */
$this->assertEquals($this->backend->getHome('uid'),'result');
@@ -808,16 +808,16 @@ public function testGetHomeWithPlugin() {
private function prepareAccessForGetDisplayName() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapUserDisplayName') {
return 'displayname';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfRoland,dc=test':
if($attr === 'displayname') {
@@ -829,7 +829,7 @@ private function prepareAccessForGetDisplayName() {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
}
@@ -841,9 +841,9 @@ public function testGetDisplayName() {
$this->connection->expects($this->any())
->method('getConnectionResource')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return true;
- }));
+ });
$user1 = $this->createMock(User::class);
$user1->expects($this->once())
@@ -894,7 +894,7 @@ public function testGetDisplayName() {
public function testGetDisplayNamePublicAPI() {
$this->access->expects($this->any())
->method('username2dn')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch ($uid) {
case 'gunslinger':
return 'dnOfRoland,dc=test';
@@ -911,16 +911,16 @@ public function testGetDisplayNamePublicAPI() {
default:
return false;
}
- }));
+ });
$this->prepareAccessForGetDisplayName();
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
$this->prepareMockForUserExists();
$this->connection->expects($this->any())
->method('getConnectionResource')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return true;
- }));
+ });
\OC_User::useBackend($backend);
@@ -989,7 +989,7 @@ public function testGetDisplayNameWithPlugin() {
public function testCountUsers() {
$this->access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(5));
+ ->willReturn(5);
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
@@ -1000,7 +1000,7 @@ public function testCountUsers() {
public function testCountUsersFailing() {
$this->access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
@@ -1134,7 +1134,7 @@ public function testLoginName2UserNameOfflineUser() {
private function prepareAccessForSetPassword($enablePasswordChange = true) {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) use (&$enablePasswordChange) {
+ ->willReturnCallback(function($name) use (&$enablePasswordChange) {
if($name === 'ldapLoginFilter') {
return '%uid';
}
@@ -1142,48 +1142,48 @@ private function prepareAccessForSetPassword($enablePasswordChange = true) {
return $enablePasswordChange?1:0;
}
return null;
- }));
+ });
$this->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'userExists'.'roland') {
return true;
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($filter) {
+ ->willReturnCallback(function($filter) {
if($filter === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('dn2username')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue('roland'));
+ ->willReturn('roland');
$this->access->expects($this->any())
->method('stringResemblesDN')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->any())
->method('setPassword')
- ->will($this->returnCallback(function($uid, $password) {
+ ->willReturnCallback(function($uid, $password) {
if(strlen($password) <= 5) {
throw new HintException('Password fails quality checking policy', '', 19);
}
return true;
- }));
+ });
}
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index 5535a28f44cdb..db23fc1ed4091 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -85,15 +85,15 @@ private function prepareLdapWrapperForConnections(MockObject &$ldap) {
$ldap->expects($this->once())
->method('connect')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(3))
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->once())
->method('bind')
- ->will($this->returnValue(true));
+ ->willReturn(true);
}
@@ -102,54 +102,54 @@ public function testCumulativeSearchOnAttributeLimited() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(23));
+ ->willReturn(23);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->exactly(2))
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(8))
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(10))
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnValue(array('cn' => array('foo'), 'count' => 1)));
+ ->willReturn(array('cn' => array('foo'), 'count' => 1));
global $uidnumber;
$uidnumber = 1;
$ldap->expects($this->exactly(10))
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
global $uidnumber;
return $uidnumber++;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');
@@ -162,18 +162,18 @@ public function testCumulativeSearchOnAttributeUnlimited() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
if($r === true) {
return true;
}
@@ -183,49 +183,49 @@ public function testCumulativeSearchOnAttributeUnlimited() {
return false;
}
return true;
- }));
+ });
$ldap->expects($this->exactly(2))
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(23));
+ ->willReturn(23);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->exactly(2))
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
global $uidnumber;
return $uidnumber;
- }));
+ });
$ldap->expects($this->exactly(46))
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
global $uidnumber;
return $uidnumber;
- }));
+ });
$ldap->expects($this->exactly(46))
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnValue(array('cn' => array('foo'), 'count' => 1)));
+ ->willReturn(array('cn' => array('foo'), 'count' => 1));
global $uidnumber;
$uidnumber = 1;
$ldap->expects($this->exactly(46))
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
global $uidnumber;
return $uidnumber++;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');
@@ -239,18 +239,18 @@ public function testDetectEmailAttributeAlreadySet() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(42));
+ ->willReturn(42);
$wizard->detectEmailAttribute();
}
@@ -261,24 +261,24 @@ public function testDetectEmailAttributeOverrideSet() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(3))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(3))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -287,7 +287,7 @@ public function testDetectEmailAttributeOverrideSet() {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -300,24 +300,24 @@ public function testDetectEmailAttributeFind() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return '';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(2))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(2))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -326,7 +326,7 @@ public function testDetectEmailAttributeFind() {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -339,24 +339,24 @@ public function testDetectEmailAttributeFindNothing() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(3))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(3))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -365,7 +365,7 @@ public function testDetectEmailAttributeFindNothing() {
return 0;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute();
$this->assertSame(false, $result->hasChanges());
@@ -378,36 +378,36 @@ public function testCumulativeSearchOnAttributeSkipReadDN() {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnCallback(function($res) {
+ ->willReturnCallback(function($res) {
return (bool)$res;
- }));
+ });
$ldap->expects($this->any())
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->any())
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(7));
+ ->willReturn(7);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->any())
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnValue(1));
+ ->willReturn(1);
global $mark;
$mark = false;
@@ -415,7 +415,7 @@ public function testCumulativeSearchOnAttributeSkipReadDN() {
$ldap->expects($this->any())
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $prev){
+ ->willReturnCallback(function($a, $prev){
$current = $prev + 1;
if($current === 7) {
return false;
@@ -426,21 +426,21 @@ public function testCumulativeSearchOnAttributeSkipReadDN() {
return 4;
}
return $current;
- }));
+ });
$ldap->expects($this->any())
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $entry) {
+ ->willReturnCallback(function($a, $entry) {
return array('cn' => array($entry), 'count' => 1);
- }));
+ });
$ldap->expects($this->any())
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
return $b;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');
diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php
index 28001a05a9210..aa6f4baef8994 100644
--- a/apps/workflowengine/tests/ManagerTest.php
+++ b/apps/workflowengine/tests/ManagerTest.php
@@ -79,9 +79,9 @@ protected function setUp(): void {
/** @var IL10N|MockObject $l */
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->legacyDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->logger = $this->createMock(ILogger::class);
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php
index 9b34afed69117..1ed7cf2758fd0 100644
--- a/tests/Core/Command/Config/System/SetConfigTest.php
+++ b/tests/Core/Command/Config/System/SetConfigTest.php
@@ -83,10 +83,10 @@ public function testSet($configNames, $newValue, $existingData, $expectedValue)
->with('name')
->willReturn($configNames);
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['value', $newValue],
['type', 'string'],
- ]));
+ ]);
$this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
@@ -119,11 +119,11 @@ public function testSetUpdateOnly($configNames, $existingData) {
->with('name')
->willReturn($configNames);
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['value', 'foobar'],
['type', 'string'],
['update-only', true],
- ]));
+ ]);
$this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index 524a193d86fb3..c1d005e0c566f 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -53,9 +53,9 @@ protected function setUp(): void {
public function testEnable() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['enable', 'true']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_type', 'file');
@@ -65,9 +65,9 @@ public function testEnable() {
public function testChangeFile() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['file', '/foo/bar/file.log']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('logfile', '/foo/bar/file.log');
@@ -89,9 +89,9 @@ public function changeRotateSizeProvider() {
*/
public function testChangeRotateSize($optionValue, $configValue) {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['rotate-size', $optionValue]
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_rotate_size', $configValue);
@@ -101,12 +101,12 @@ public function testChangeRotateSize($optionValue, $configValue) {
public function testGetConfiguration() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['log_type', 'file', 'log_type_value'],
['datadirectory', \OC::$SERVERROOT.'/data', '/data/directory/'],
['logfile', '/data/directory/nextcloud.log', '/var/log/nextcloud.log'],
['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024],
- ]));
+ ]);
$this->consoleOutput->expects($this->at(0))
->method('writeln')
diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php
index d73bc7ed9c2e9..cae6293abd1ba 100644
--- a/tests/Core/Command/Log/ManageTest.php
+++ b/tests/Core/Command/Log/ManageTest.php
@@ -53,9 +53,9 @@ protected function setUp(): void {
public function testChangeBackend() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['backend', 'syslog']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_type', 'syslog');
@@ -65,9 +65,9 @@ public function testChangeBackend() {
public function testChangeLevel() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['level', 'debug']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('loglevel', 0);
@@ -77,9 +77,9 @@ public function testChangeLevel() {
public function testChangeTimezone() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['timezone', 'UTC']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('logtimezone', 'UTC');
diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
index 3260879686488..d7238921af572 100644
--- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
+++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
@@ -101,16 +101,16 @@ public function testAddMimetype() {
]);
$this->loader->expects($this->exactly(2))
->method('exists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', true],
['testing/newmimetype', false],
- ]));
+ ]);
$this->loader->expects($this->exactly(2))
->method('getId')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', 1],
['testing/newmimetype', 2],
- ]));
+ ]);
$this->loader->expects($this->once())
->method('updateFilecache')
@@ -158,14 +158,14 @@ public function testRepairFilecache() {
]);
$this->loader->expects($this->exactly(1))
->method('exists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', true],
- ]));
+ ]);
$this->loader->expects($this->exactly(1))
->method('getId')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', 1],
- ]));
+ ]);
$this->loader->expects($this->once())
->method('updateFilecache')
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index 5c66c06a2c52d..d2ae9b036b975 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -92,7 +92,7 @@ protected function setUp(): void {
$this->cache = $this->getMockBuilder('OCP\ICache')
->disableOriginalConstructor()->getMock();
$this->l = $this->getMockBuilder(IL10N::class)->getMock();
- $this->l->method('t')->will($this->returnArgument(0));
+ $this->l->method('t')->willReturnArgument(0);
$this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php
index a55b0bc232e0c..175628552bc62 100644
--- a/tests/Core/Controller/ChangePasswordControllerTest.php
+++ b/tests/Core/Controller/ChangePasswordControllerTest.php
@@ -57,7 +57,7 @@ protected function setUp(): void {
$this->groupManager = $this->createMock(\OC\Group\Manager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->l = $this->createMock(IL10N::class);
- $this->l->method('t')->will($this->returnArgument(0));
+ $this->l->method('t')->willReturnArgument(0);
/** @var IRequest|\PHPUnit_Framework_MockObject_MockObject $request */
$request = $this->createMock(IRequest::class);
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php
index 3932cb9e144f1..cd90918144d0b 100644
--- a/tests/Core/Controller/ClientFlowLoginControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php
@@ -83,9 +83,9 @@ protected function setUp(): void {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$this->defaults = $this->createMock(Defaults::class);
$this->session = $this->createMock(ISession::class);
$this->tokenProvider = $this->createMock(IProvider::class);
diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
index 3c39a402f5560..01c60dd7511f6 100644
--- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
@@ -183,9 +183,9 @@ public function testShowAuthPickerValidLoginToken() {
public function testGrantPageInvalidStateToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
return null;
- }));
+ });
$result = $this->controller->grantPage('stateToken');
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
@@ -193,7 +193,7 @@ public function testGrantPageInvalidStateToken() {
public function testGrantPageInvalidLoginToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -201,7 +201,7 @@ public function testGrantPageInvalidLoginToken() {
return 'loginToken';
}
return null;
- }));
+ });
$this->loginFlowV2Service->method('getByLoginToken')
->with('loginToken')
@@ -213,7 +213,7 @@ public function testGrantPageInvalidLoginToken() {
public function testGrantPageValid() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -221,7 +221,7 @@ public function testGrantPageValid() {
return 'loginToken';
}
return null;
- }));
+ });
$flow = new LoginFlowV2();
$this->loginFlowV2Service->method('getByLoginToken')
@@ -235,9 +235,9 @@ public function testGrantPageValid() {
public function testGenerateAppPasswordInvalidStateToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
return null;
- }));
+ });
$result = $this->controller->generateAppPassword('stateToken');
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
@@ -245,7 +245,7 @@ public function testGenerateAppPasswordInvalidStateToken() {
public function testGenerateAppPassworInvalidLoginToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -253,7 +253,7 @@ public function testGenerateAppPassworInvalidLoginToken() {
return 'loginToken';
}
return null;
- }));
+ });
$this->loginFlowV2Service->method('getByLoginToken')
->with('loginToken')
@@ -265,7 +265,7 @@ public function testGenerateAppPassworInvalidLoginToken() {
public function testGenerateAppPassworValid() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -273,7 +273,7 @@ public function testGenerateAppPassworValid() {
return 'loginToken';
}
return null;
- }));
+ });
$flow = new LoginFlowV2();
$this->loginFlowV2Service->method('getByLoginToken')
@@ -283,14 +283,14 @@ public function testGenerateAppPassworValid() {
$clearedState = false;
$clearedLogin = false;
$this->session->method('remove')
- ->will($this->returnCallback(function ($name) use (&$clearedLogin, &$clearedState) {
+ ->willReturnCallback(function ($name) use (&$clearedLogin, &$clearedState) {
if ($name === 'client.flow.v2.state.token') {
$clearedState = true;
}
if ($name === 'client.flow.v2.login.token') {
$clearedLogin = true;
}
- }));
+ });
$this->session->method('getId')
->willReturn('sessionId');
diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php
index c0d1ea42f4195..daccee8270571 100644
--- a/tests/Core/Controller/CssControllerTest.php
+++ b/tests/Core/Controller/CssControllerTest.php
@@ -158,13 +158,13 @@ public function testGetGzipFileNotFound() {
->willReturn($folder);
$folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($fileName) use ($file) {
if ($fileName === 'file.css') {
return $file;
}
throw new NotFoundException();
- })
+ }
);
$this->request->method('getHeader')
diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php
index 26df6d181ef50..4476b3ee6ed35 100644
--- a/tests/Core/Controller/JsControllerTest.php
+++ b/tests/Core/Controller/JsControllerTest.php
@@ -158,13 +158,13 @@ public function testGetGzipFileNotFound() {
->willReturn($folder);
$folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($fileName) use ($file) {
if ($fileName === 'file.js') {
return $file;
}
throw new NotFoundException();
- })
+ }
);
$this->request->method('getHeader')
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 6a6795a8e82a2..cddf89527db6b 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -315,10 +315,10 @@ public function testShowLoginFormWithPasswordResetOption($canChangePassword,
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['login_form_autocomplete', true, true],
['lost_password_link', '', false],
- ]));
+ ]);
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
@@ -363,10 +363,10 @@ public function testShowLoginFormForUserNamed0() {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['login_form_autocomplete', true, true],
['lost_password_link', '', false],
- ]));
+ ]);
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('canChangePassword')
@@ -435,7 +435,7 @@ public function testLoginWithInvalidCredentials() {
'user' => $user,
'redirect_url' => '/apps/files',
])
- ->will($this->returnValue($loginPageUrl));
+ ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
$expected->throttle(['user' => 'MyUserName']);
@@ -475,7 +475,7 @@ public function testLoginWithoutPassedCsrfCheckAndNotLoggedIn() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('jane'));
+ ->willReturn('jane');
$password = 'secret';
$originalUrl = 'another%20url';
@@ -486,7 +486,7 @@ public function testLoginWithoutPassedCsrfCheckAndNotLoggedIn() {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->with()
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config->expects($this->never())
->method('deleteUserValue');
$this->userSession->expects($this->never())
@@ -501,7 +501,7 @@ public function testLoginWithoutPassedCsrfCheckAndLoggedIn() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('jane'));
+ ->willReturn('jane');
$password = 'secret';
$originalUrl = 'another%20url';
$redirectUrl = 'http://localhost/another url';
@@ -513,11 +513,11 @@ public function testLoginWithoutPassedCsrfCheckAndLoggedIn() {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->with()
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with(urldecode($originalUrl))
- ->will($this->returnValue($redirectUrl));
+ ->willReturn($redirectUrl);
$this->config->expects($this->never())
->method('deleteUserValue');
$this->userSession->expects($this->never())
@@ -558,7 +558,7 @@ public function testLoginWithValidCredentialsAndRedirectUrl() {
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with(urldecode('/apps/mail'))
- ->will($this->returnValue($redirectUrl));
+ ->willReturn($redirectUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl);
$response = $this->loginController->tryLogin($user, $password, '%2Fapps%2Fmail');
@@ -592,7 +592,7 @@ public function testToNotLeakLoginName() {
'user' => 'john@doe.com',
'redirect_url' => '/apps/files',
])
- ->will($this->returnValue($loginPageUrl));
+ ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
$expected->throttle(['user' => 'john']);
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 27344102f0aee..fdbca1ea3b17d 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -110,9 +110,9 @@ protected function setUp(): void {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$this->defaults = $this->getMockBuilder('\OCP\Defaults')
->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder(IUserManager::class)
@@ -179,7 +179,7 @@ public function testResetFormInvalidTokenMatch() {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedToken');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->userManager->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
@@ -210,7 +210,7 @@ public function testResetFormExpiredToken() {
->expects($this->once())
->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
- ->will($this->returnValue('encryptedToken'));
+ ->willReturn('encryptedToken');
$this->crypto->method('decrypt')
->with(
$this->equalTo('encryptedToken'),
@@ -257,7 +257,7 @@ public function testResetFormValidToken() {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.setPassword', array('userId' => 'ValidTokenUser', 'token' => 'TheOnlyAndOnlyOneTokenToResetThePassword'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$this->initialStateService->expects($this->at(0))
->method('provideInitialState')
@@ -280,10 +280,10 @@ public function testEmailUnsuccessful() {
$this->userManager
->expects($this->any())
->method('userExists')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array(true, $existingUser),
array(false, $nonExistingUser)
- )));
+ ));
$this->logger->expects($this->exactly(0))
->method('logException');
@@ -307,7 +307,7 @@ public function testEmailUnsuccessful() {
->expects($this->any())
->method('getUserValue')
->with($existingUser, 'settings', 'email')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$response = $this->lostController->email($existingUser);
$expectedResponse = new JSONResponse([
'status' => 'success',
@@ -321,7 +321,7 @@ public function testEmailSuccessful() {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -330,7 +330,7 @@ public function testEmailSuccessful() {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->config
->expects($this->once())
->method('setUserValue')
@@ -339,7 +339,7 @@ public function testEmailSuccessful() {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->getMockBuilder('\OC\Mail\Message')
->disableOriginalConstructor()->getMock();
$message
@@ -371,7 +371,7 @@ public function testEmailSuccessful() {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -394,7 +394,7 @@ public function testEmailWithMailSuccessful() {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -408,7 +408,7 @@ public function testEmailWithMailSuccessful() {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->config
->expects($this->once())
->method('setUserValue')
@@ -417,7 +417,7 @@ public function testEmailWithMailSuccessful() {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->getMockBuilder('\OC\Mail\Message')
->disableOriginalConstructor()->getMock();
$message
@@ -449,7 +449,7 @@ public function testEmailWithMailSuccessful() {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -472,7 +472,7 @@ public function testEmailCantSendException() {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -485,12 +485,12 @@ public function testEmailCantSendException() {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->urlGenerator
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->createMock(Message::class);
$message
->expects($this->at(0))
@@ -521,7 +521,7 @@ public function testEmailCantSendException() {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -548,7 +548,7 @@ public function testSetPasswordUnsuccessful() {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -559,7 +559,7 @@ public function testSetPasswordUnsuccessful() {
$this->config->expects($this->never())
->method('deleteUserValue');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
@@ -577,7 +577,7 @@ public function testSetPasswordSuccessful() {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -589,7 +589,7 @@ public function testSetPasswordSuccessful() {
->method('deleteUserValue')
->with('ValidTokenUser', 'core', 'lostpassword');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
@@ -654,14 +654,14 @@ public function testSetPasswordExpiredTokenDueToLogin() {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12346));
+ ->willReturn(12346);
$this->userManager
->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
$this->timeFactory
->method('getTime')
- ->will($this->returnValue(12345));
+ ->willReturn(12345);
$this->crypto->method('decrypt')
->with(
@@ -781,7 +781,7 @@ public function testSetPasswordDontProceedMasterKey() {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -793,7 +793,7 @@ public function testSetPasswordDontProceedMasterKey() {
->method('deleteUserValue')
->with('ValidTokenUser', 'core', 'lostpassword');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
index 40453db572945..fa15550056783 100644
--- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php
+++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
@@ -100,11 +100,11 @@ public function testSelectChallenge() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$expected = new StandaloneTemplateResponse('core', 'twofactorselectchallenge', [
'providers' => [
@@ -131,32 +131,32 @@ public function testShowChallenge() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('u2f'));
+ ->willReturn('u2f');
$backupProvider->expects($this->once())
->method('getId')
- ->will($this->returnValue('backup_codes'));
+ ->willReturn('backup_codes');
$this->session->expects($this->once())
->method('exists')
->with('two_factor_auth_error')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->exactly(2))
->method('remove')
->with($this->logicalOr($this->equalTo('two_factor_auth_error'), $this->equalTo('two_factor_auth_error_message')));
$provider->expects($this->once())
->method('getTemplate')
->with($user)
- ->will($this->returnValue($tmpl));
+ ->willReturn($tmpl);
$tmpl->expects($this->once())
->method('fetchPage')
- ->will($this->returnValue(''));
+ ->willReturn('');
$expected = new StandaloneTemplateResponse('core', 'twofactorshowchallenge', [
'error' => true,
@@ -177,15 +177,15 @@ public function testShowInvalidChallenge() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('select/challenge/url'));
+ ->willReturn('select/challenge/url');
$expected = new RedirectResponse('select/challenge/url');
@@ -198,16 +198,16 @@ public function testSolveChallenge() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
->with('myprovider', $user, 'token')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = new RedirectResponse(OC_Util::getDefaultPageUrl());
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
@@ -219,11 +219,11 @@ public function testSolveValidChallengeAndRedirect() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
@@ -243,15 +243,15 @@ public function testSolveChallengeInvalidProvider() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('select/challenge/url'));
+ ->willReturn('select/challenge/url');
$expected = new RedirectResponse('select/challenge/url');
@@ -264,16 +264,16 @@ public function testSolveInvalidChallenge() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
->with('myprovider', $user, 'token')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->once())
->method('set')
->with('two_factor_auth_error', true);
@@ -283,10 +283,10 @@ public function testSolveInvalidChallenge() {
'challengeProviderId' => 'myprovider',
'redirect_url' => '/url',
])
- ->will($this->returnValue('files/index/url'));
+ ->willReturn('files/index/url');
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('myprovider'));
+ ->willReturn('myprovider');
$expected = new RedirectResponse('files/index/url');
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url'));
@@ -299,11 +299,11 @@ public function testSolveChallengeTwoFactorException() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
@@ -321,10 +321,10 @@ public function testSolveChallengeTwoFactorException() {
'challengeProviderId' => 'myprovider',
'redirect_url' => '/url',
])
- ->will($this->returnValue('files/index/url'));
+ ->willReturn('files/index/url');
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('myprovider'));
+ ->willReturn('myprovider');
$expected = new RedirectResponse('files/index/url');
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url'));
@@ -334,7 +334,7 @@ public function testSetUpProviders() {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$this->twoFactorManager->expects($this->once())
->method('getLoginSetupProviders')
@@ -363,7 +363,7 @@ public function testSetUpInvalidProvider() {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$provider->expects($this->any())
->method('getId')
@@ -389,7 +389,7 @@ public function testSetUpProvider() {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$provider->expects($this->any())
->method('getId')
diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php
index b5e43b2999d45..78112f09fd6cf 100644
--- a/tests/Core/Controller/UserControllerTest.php
+++ b/tests/Core/Controller/UserControllerTest.php
@@ -56,12 +56,12 @@ public function testGetDisplayNames() {
$this->userManager
->method('get')
- ->will($this->returnCallback(function ($uid) use ($user) {
+ ->willReturnCallback(function ($uid) use ($user) {
if ($uid === 'foo') {
return $user;
}
return null;
- }));
+ });
$expected = new JSONResponse([
'users' => [
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 2198cc7d5b4c6..ac3a5fbc017b1 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -100,10 +100,10 @@ public function testBeforeControllerNotLoggedIn() {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->never())
->method('getUser');
@@ -115,7 +115,7 @@ public function testBeforeControllerPublicPage() {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->never())
->method('isLoggedIn');
@@ -147,17 +147,17 @@ public function testBeforeControllerNoTwoFactorCheckNeeded() {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -171,21 +171,21 @@ public function testBeforeControllerTwoFactorAuthRequired() {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -201,18 +201,18 @@ public function testBeforeControllerUserAlreadyLoggedIn() {
->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$twoFactorChallengeController = $this->getMockBuilder('\OC\Core\Controller\TwoFactorChallengeController')
->disableOriginalConstructor()
@@ -226,7 +226,7 @@ public function testAfterExceptionTwoFactorAuthRequired() {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('test/url'));
+ ->willReturn('test/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('test/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -238,7 +238,7 @@ public function testAfterException() {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('files.view.index')
- ->will($this->returnValue('redirect/url'));
+ ->willReturn('redirect/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('redirect/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -249,9 +249,9 @@ public function testRequires2FASetupDoneAnnotated() {
$this->reflector
->method('hasAnnotation')
- ->will($this->returnCallback(function (string $annotation) {
+ ->willReturnCallback(function (string $annotation) {
return $annotation === 'TwoFactorSetUpDoneRequired';
- }));
+ });
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(true);
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php
index bf6902fde6544..ebb034253752a 100644
--- a/tests/lib/APITest.php
+++ b/tests/lib/APITest.php
@@ -79,7 +79,7 @@ public function testIsV2($scriptName, $expected) {
$request
->expects($this->once())
->method('getScriptName')
- ->will($this->returnValue($scriptName));
+ ->willReturn($scriptName);
$this->assertEquals($expected, $this->invokePrivate(new \OC_API, 'isV2', [$request]));
}
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index 80ddcbbd35471..97af541085b16 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -190,7 +190,7 @@ public function testSetUserValueUnchanged() {
->disableOriginalConstructor()->getMock();
$resultMock->expects($this->once())
->method('fetchColumn')
- ->will($this->returnValue('valueSetUnchanged'));
+ ->willReturn('valueSetUnchanged');
$connectionMock = $this->createMock(IDBConnection::class);
$connectionMock->expects($this->once())
@@ -198,7 +198,7 @@ public function testSetUserValueUnchanged() {
->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '.
'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'),
$this->equalTo(array('userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged')))
- ->will($this->returnValue($resultMock));
+ ->willReturn($resultMock);
$connectionMock->expects($this->never())
->method('executeUpdate');
@@ -411,7 +411,7 @@ public function testGetUsersForUserValue() {
->method('getValue')
->with($this->equalTo('dbtype'),
$this->equalTo('sqlite'))
- ->will($this->returnValue(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite')));
+ ->willReturn(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite'));
$config = $this->getConfig($systemConfig);
// preparation - add something to the database
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 0e895b5f9993a..50c1e13b3f938 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -40,20 +40,20 @@ protected function getAppConfig() {
$config->expects($this->any())
->method('getValue')
- ->will($this->returnCallback(function ($app, $key, $default) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key, $default) use (&$appConfig) {
return (isset($appConfig[$app]) and isset($appConfig[$app][$key])) ? $appConfig[$app][$key] : $default;
- }));
+ });
$config->expects($this->any())
->method('setValue')
- ->will($this->returnCallback(function ($app, $key, $value) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key, $value) use (&$appConfig) {
if (!isset($appConfig[$app])) {
$appConfig[$app] = array();
}
$appConfig[$app][$key] = $value;
- }));
+ });
$config->expects($this->any())
->method('getValues')
- ->will($this->returnCallback(function ($app, $key) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key) use (&$appConfig) {
if ($app) {
return $appConfig[$app];
} else {
@@ -65,7 +65,7 @@ protected function getAppConfig() {
}
return $values;
}
- }));
+ });
return $config;
}
@@ -346,7 +346,7 @@ public function testIsEnabledForUserEnabledForGroup() {
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
@@ -357,7 +357,7 @@ public function testIsEnabledForUserDisabledForGroup() {
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('bar')));
+ ->willReturn(array('bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
@@ -373,11 +373,11 @@ public function testIsEnabledForUserLoggedIn() {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isEnabledForUser('test'));
@@ -410,7 +410,7 @@ public function testGetAppsForUser() {
$this->groupManager->expects($this->any())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
@@ -462,11 +462,11 @@ public function testGetAppsNeedingUpgrade() {
$manager->expects($this->any())
->method('getAppInfo')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appId) use ($appInfos) {
return $appInfos[$appId];
}
- ));
+ );
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test1', 'installed_version', '1.0.0');
@@ -511,11 +511,11 @@ public function testGetIncompatibleApps() {
$manager->expects($this->any())
->method('getAppInfo')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appId) use ($appInfos) {
return $appInfos[$appId];
}
- ));
+ );
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'yes');
@@ -532,7 +532,7 @@ public function testGetEnabledAppsForGroup() {
$group = $this->createMock(IGroup::class);
$group->expects($this->any())
->method('getGID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php
index 2c566b0ea0a42..dc7e1920896d9 100644
--- a/tests/lib/App/AppStore/Bundles/BundleBase.php
+++ b/tests/lib/App/AppStore/Bundles/BundleBase.php
@@ -41,9 +41,9 @@ protected function setUp(): void {
parent::setUp();
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
}
public function testGetIdentifier() {
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 38e813dc251c2..30d1fec6c9e9c 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1946,14 +1946,14 @@ public function testGetWithFilter() {
public function testAppstoreDisabled() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'appstoreenabled') {
return false;
} else if ($var === 'version') {
return '11.0.0.2';
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1965,14 +1965,14 @@ public function testAppstoreDisabled() {
public function testNoInternet() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'has_internet_connection') {
return false;
} else if ($var === 'version') {
return '11.0.0.2';
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
index 8a82322b61cd1..22e7a8742ec1a 100644
--- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -41,12 +41,12 @@ protected function setUp(): void {
public function testAppstoreDisabled() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'appstoreenabled') {
return false;
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -57,12 +57,12 @@ public function testAppstoreDisabled() {
public function testNoInternet() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'has_internet_connection') {
return false;
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 943b53eee6478..8312bef5b9842 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -32,41 +32,41 @@ protected function setUp(): void {
->getMock();
$this->platformMock->expects($this->any())
->method('getPhpVersion')
- ->will( $this->returnValue('5.4.3'));
+ ->willReturn( '5.4.3');
$this->platformMock->expects($this->any())
->method('getIntSize')
- ->will( $this->returnValue('4'));
+ ->willReturn( '4');
$this->platformMock->expects($this->any())
->method('getDatabase')
- ->will( $this->returnValue('mysql'));
+ ->willReturn( 'mysql');
$this->platformMock->expects($this->any())
->method('getOS')
- ->will( $this->returnValue('Linux'));
+ ->willReturn( 'Linux');
$this->platformMock->expects($this->any())
->method('isCommandKnown')
- ->will( $this->returnCallback(function($command) {
+ ->willReturnCallback( function($command) {
return ($command === 'grep');
- }));
+ });
$this->platformMock->expects($this->any())
->method('getLibraryVersion')
- ->will( $this->returnCallback(function($lib) {
+ ->willReturnCallback( function($lib) {
if ($lib === 'curl') {
return "2.3.4";
}
return null;
- }));
+ });
$this->platformMock->expects($this->any())
->method('getOcVersion')
- ->will( $this->returnValue('8.0.2'));
+ ->willReturn( '8.0.2');
$this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$this->analyser = new DependencyAnalyzer($this->platformMock, $this->l10nMock);
}
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index ccc694942a1f7..3fb18979b8a84 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -93,7 +93,7 @@ public function testControllerNameAndMethodAreBeingPassed(){
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -133,7 +133,7 @@ public function testOutputIsPrinted(){
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->once())
->method('setOutput')
->with($this->equalTo($this->output));
@@ -156,7 +156,7 @@ public function testNoOutput(string $statusCode) {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->once())
->method('setHeader')
->with($this->equalTo($statusCode));
@@ -175,7 +175,7 @@ public function testCallbackIsCalled(){
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$mock->expects($this->once())
->method('callback');
App::main($this->controllerName, $this->controllerMethod, $this->container, []);
@@ -190,7 +190,7 @@ public function testCoreApp() {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -207,7 +207,7 @@ public function testSettingsApp() {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -224,7 +224,7 @@ public function testApp() {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index 8eb76d3cb27b6..0f4b83ff5cafd 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -136,7 +136,7 @@ public function testAuthenticateValidPassword() {
$hashSet = false;
$this->session
->method('set')
- ->will($this->returnCallback(function($key, $value) use (&$tokenSet, &$hashSet) {
+ ->willReturnCallback(function($key, $value) use (&$tokenSet, &$hashSet) {
if ($key === 'public_link_authenticated_token' && $value === 'token') {
$tokenSet = true;
return true;
@@ -146,7 +146,7 @@ public function testAuthenticateValidPassword() {
return true;
}
return false;
- }));
+ });
$this->urlGenerator->method('linkToRoute')
->willReturn('myLink!');
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index b1cb1ceab6fc6..23ebe6ec98472 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -89,7 +89,7 @@ protected function setUp(): void {
->getMock();
$this->app->expects($this->any())
->method('getAppName')
- ->will($this->returnValue('apptemplate_advanced'));
+ ->willReturn('apptemplate_advanced');
$this->controller = new ChildController($this->app, $request);
}
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php
index a69980fbb26e2..67d88c879a3b8 100644
--- a/tests/lib/AppFramework/Db/MapperTest.php
+++ b/tests/lib/AppFramework/Db/MapperTest.php
@@ -148,7 +148,7 @@ public function testCreate(){
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
- ->will($this->returnValue(3));
+ ->willReturn(3);
$this->mapper = new ExampleMapper($this->db);
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
@@ -168,7 +168,7 @@ public function testCreateShouldReturnItemWithCorrectInsertId(){
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
- ->will($this->returnValue(3));
+ ->willReturn(3);
$this->mapper = new ExampleMapper($this->db);
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php
index 83156a3932bc8..cddf015cbea90 100644
--- a/tests/lib/AppFramework/Db/MapperTestUtility.php
+++ b/tests/lib/AppFramework/Db/MapperTestUtility.php
@@ -124,7 +124,7 @@ protected function setMapperResult($sql, $arguments=array(), $returnRows=array()
$this->query->expects($this->any())
->method('fetch')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function() use ($iterators, $fetchAt){
$iterator = $iterators[$fetchAt];
$result = $iterator->next();
@@ -137,7 +137,7 @@ function() use ($iterators, $fetchAt){
return $result;
}
- ));
+ );
if ($this->isAssocArray($arguments)) {
foreach($arguments as $key => $argument) {
@@ -165,9 +165,9 @@ function() use ($iterators, $fetchAt){
$this->query->expects($this->at($this->queryAt))
->method('execute')
- ->will($this->returnCallback(function($sql, $p=null, $o=null, $s=null) {
+ ->willReturnCallback(function($sql, $p=null, $o=null, $s=null) {
- }));
+ });
$this->queryAt++;
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index 1c4dc067b5dfe..494f19a6d24ab 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -156,7 +156,7 @@ private function setMiddlewareExpectations($out=null,
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($exception))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
} else {
$this->middlewareDispatcher->expects($this->once())
->method('afterException')
@@ -173,51 +173,51 @@ private function setMiddlewareExpectations($out=null,
$this->equalTo($this->controllerMethod));
$this->controller->expects($this->once())
->method($this->controllerMethod)
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
}
$this->response->expects($this->once())
->method('render')
- ->will($this->returnValue($out));
+ ->willReturn($out);
$this->response->expects($this->once())
->method('getStatus')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->response->expects($this->once())
->method('getLastModified')
- ->will($this->returnValue($this->lastModified));
+ ->willReturn($this->lastModified);
$this->response->expects($this->once())
->method('getETag')
- ->will($this->returnValue($this->etag));
+ ->willReturn($this->etag);
$this->response->expects($this->once())
->method('getHeaders')
- ->will($this->returnValue($responseHeaders));
+ ->willReturn($responseHeaders);
$this->http->expects($this->once())
->method('getStatusHeader')
->with($this->equalTo(Http::STATUS_OK),
$this->equalTo($this->lastModified),
$this->equalTo($this->etag))
- ->will($this->returnValue($httpHeaders));
+ ->willReturn($httpHeaders);
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($this->response))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($this->response))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
$this->middlewareDispatcher->expects($this->once())
->method('beforeOutput')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($out))
- ->will($this->returnValue($out));
+ ->willReturn($out);
}
@@ -281,14 +281,14 @@ private function dispatcherPassthrough() {
->method('beforeController');
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
- ->will($this->returnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function($a, $b, $in) {
return $in;
- }));
+ });
$this->middlewareDispatcher->expects($this->once())
->method('beforeOutput')
- ->will($this->returnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function($a, $b, $in) {
return $in;
- }));
+ });
}
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index be019050e1bc0..67fef79dcff4e 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -378,7 +378,7 @@ public function testGetIdWithoutModUnique() {
$this->secureRandom->expects($this->once())
->method('generate')
->with('20')
- ->will($this->returnValue('GeneratedByOwnCloudItself'));
+ ->willReturn('GeneratedByOwnCloudItself');
$request = new Request(
[],
@@ -409,7 +409,7 @@ public function testGetRemoteAddressWithoutTrustedRemote() {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -433,12 +433,12 @@ public function testGetRemoteAddressWithNoTrustedHeader() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -462,12 +462,12 @@ public function testGetRemoteAddressWithSingleTrustedRemote() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -491,12 +491,12 @@ public function testGetRemoteAddressIPv6WithSingleTrustedRemote() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -520,16 +520,16 @@ public function testGetRemoteAddressVerifyPriorityHeader() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -553,16 +553,16 @@ public function testGetRemoteAddressIPv6VerifyPriorityHeader() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -586,12 +586,12 @@ public function testGetRemoteAddressWithMatchingCidrTrustedRemote() {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED_FOR']));
+ ->willReturn(['HTTP_X_FORWARDED_FOR']);
$request = new Request(
[
@@ -615,7 +615,7 @@ public function testGetRemoteAddressWithNotMatchingCidrTrustedRemote() {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$request = new Request(
[
@@ -690,17 +690,17 @@ public function testGetServerProtocolWithOverride() {
->expects($this->at(0))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$request = new Request(
[],
@@ -716,13 +716,13 @@ public function testGetServerProtocolWithOverride() {
public function testGetServerProtocolWithProtoValid() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$requestHttps = new Request(
[
@@ -757,9 +757,9 @@ public function testGetServerProtocolWithProtoValid() {
public function testGetServerProtocolWithHttpsServerValueOn() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -778,9 +778,9 @@ public function testGetServerProtocolWithHttpsServerValueOn() {
public function testGetServerProtocolWithHttpsServerValueOff() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -799,9 +799,9 @@ public function testGetServerProtocolWithHttpsServerValueOff() {
public function testGetServerProtocolWithHttpsServerValueEmpty() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -820,9 +820,9 @@ public function testGetServerProtocolWithHttpsServerValueEmpty() {
public function testGetServerProtocolDefault() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[],
@@ -837,13 +837,13 @@ public function testGetServerProtocolDefault() {
public function testGetServerProtocolBehindLoadBalancers() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1059,13 +1059,13 @@ public function testInsecureServerHostHttpHostHeader() {
public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1088,13 +1088,13 @@ public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1117,7 +1117,7 @@ public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
public function testGetServerHostWithOverwriteHost() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'overwritecondaddr') {
return '';
} else if ($key === 'overwritehost') {
@@ -1125,7 +1125,7 @@ public function testGetServerHostWithOverwriteHost() {
}
return $default;
- }));
+ });
$request = new Request(
[],
@@ -1141,7 +1141,7 @@ public function testGetServerHostWithOverwriteHost() {
public function testGetServerHostWithTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1149,7 +1149,7 @@ public function testGetServerHostWithTrustedDomain() {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1170,7 +1170,7 @@ public function testGetServerHostWithTrustedDomain() {
public function testGetServerHostWithUntrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1178,7 +1178,7 @@ public function testGetServerHostWithUntrustedDomain() {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1199,12 +1199,12 @@ public function testGetServerHostWithUntrustedDomain() {
public function testGetServerHostWithNoTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1273,7 +1273,7 @@ public function testGetOverwriteHostDefaultNull() {
->expects($this->once())
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[],
$this->secureRandom,
@@ -1290,17 +1290,17 @@ public function testGetOverwriteHostWithOverwrite() {
->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$request = new Request(
[],
@@ -1485,7 +1485,7 @@ public function testGetRequestUriWithoutOverwrite() {
->expects($this->once())
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[
@@ -1517,12 +1517,12 @@ public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot,
->expects($this->at(0))
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue($overwriteWebRoot));
+ ->willReturn($overwriteWebRoot);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue($overwriteCondAddr));
+ ->willReturn($overwriteCondAddr);
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1542,7 +1542,7 @@ public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot,
$request
->expects($this->once())
->method('getScriptName')
- ->will($this->returnValue('/scriptname.php'));
+ ->willReturn('/scriptname.php');
$this->assertSame($expectedUri, $request->getRequestUri());
}
diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php
index ef7132013b6ff..b66d9c5ed1d4f 100644
--- a/tests/lib/AppFramework/Http/StreamResponseTest.php
+++ b/tests/lib/AppFramework/Http/StreamResponseTest.php
@@ -44,7 +44,7 @@ public function testOutputNotModified(){
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_NOT_MODIFIED));
+ ->willReturn(Http::STATUS_NOT_MODIFIED);
$this->output->expects($this->never())
->method('setReadfile');
$response = new StreamResponse($path);
@@ -56,11 +56,11 @@ public function testOutputOk(){
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->once())
->method('setReadfile')
->with($this->equalTo($path))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$response = new StreamResponse($path);
$response->callback($this->output);
@@ -70,7 +70,7 @@ public function testOutputNotFound(){
$path = __FILE__ . 'test';
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->never())
->method('setReadfile');
$this->output->expects($this->once())
@@ -85,10 +85,10 @@ public function testOutputReadFileError(){
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->once())
->method('setReadfile')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->output->expects($this->once())
->method('setHttpResponseCode')
->with($this->equalTo(Http::STATUS_BAD_REQUEST));
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index 965637cb4c492..4790e9baca764 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -158,7 +158,7 @@ public function testAfterExceptionShouldReturnResponseOfMiddleware(){
->getMock();
$m2->expects($this->once())
->method('afterException')
- ->will($this->returnValue($response));
+ ->willReturn($response);
$this->dispatcher->registerMiddleware($m1);
$this->dispatcher->registerMiddleware($m2);
@@ -282,7 +282,7 @@ public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMidd
$m3->expects($this->never())
->method('afterController');
$m3->method('beforeOutput')
- ->will($this->returnArgument(2));
+ ->willReturnArgument(2);
$this->dispatcher->registerMiddleware($m3);
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index 1c12a4aa153b8..691553a13d878 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -140,7 +140,7 @@ public function testNoCORSShouldAllowCookieAuth() {
$this->session->expects($this->never())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reflector->reflect($this, __FUNCTION__);
$middleware->beforeController($this->controller, __FUNCTION__);
@@ -163,7 +163,7 @@ public function testCORSShouldRelogin() {
$this->session->expects($this->once())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
@@ -215,7 +215,7 @@ public function testCORSShouldNotAllowCookieAuth() {
$this->session->expects($this->once())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index ae0e6ff484da9..5a8260d796865 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -218,7 +218,7 @@ public function testAjaxStatusAllGood() {
public function testNoChecks(){
$this->request->expects($this->never())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$sec = $this->getMiddleware(false, false, false);
@@ -262,10 +262,10 @@ public function testCsrfCheck(){
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
}
@@ -278,7 +278,7 @@ public function testCsrfCheck(){
public function testNoCsrfCheck(){
$this->request->expects($this->never())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -290,10 +290,10 @@ public function testNoCsrfCheck(){
public function testPassesCsrfCheck(){
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -307,10 +307,10 @@ public function testFailCsrfCheck(){
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -327,7 +327,7 @@ public function testStrictCookieRequiredCheck() {
->method('passesCSRFCheck');
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -341,7 +341,7 @@ public function testStrictCookieRequiredCheck() {
public function testNoStrictCookieRequiredCheck() {
$this->request->expects($this->never())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -393,7 +393,7 @@ public function dataCsrfOcsController() {
public function testCsrfOcsController(Controller $controller, bool $hasOcsApiHeader, bool $hasBearerAuth, bool $exception) {
$this->request
->method('getHeader')
- ->will(self::returnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) {
+ ->willReturnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) {
if ($header === 'OCS-APIREQUEST' && $hasOcsApiHeader) {
return 'true';
}
@@ -401,7 +401,7 @@ public function testCsrfOcsController(Controller $controller, bool $hasOcsApiHea
return 'Bearer TOKEN!';
}
return '';
- }));
+ });
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
->willReturn(true);
@@ -511,7 +511,7 @@ public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
'redirect_url' => 'nextcloud/index.php/apps/specialapp',
]
)
- ->will($this->returnValue('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'));
+ ->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp');
$this->logger
->expects($this->once())
->method('logException');
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index 1b7ab054a0f5f..4d184adcdb1e4 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -245,7 +245,7 @@ private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName,
->expects($this->once())
->method('create')
->with($this->equalTo('app1.' . $name), $this->equalTo($url))
- ->will($this->returnValue($route));
+ ->willReturn($route);
// load route configuration
$config = new RouteConfig($container, $router, $routes);
@@ -293,7 +293,7 @@ private function assertSimpleOCSRoute($routes,
->expects($this->once())
->method('create')
->with($this->equalTo('ocs.app1.' . $name), $this->equalTo($url))
- ->will($this->returnValue($route));
+ ->willReturn($route);
// load route configuration
$config = new RouteConfig($container, $router, $routes);
@@ -391,31 +391,31 @@ private function assertResource($yaml, $resourceName, $url, $controllerName, $pa
->expects($this->at(0))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.index'), $this->equalTo($url))
- ->will($this->returnValue($indexRoute));
+ ->willReturn($indexRoute);
$router
->expects($this->at(1))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.show'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($showRoute));
+ ->willReturn($showRoute);
$router
->expects($this->at(2))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.create'), $this->equalTo($url))
- ->will($this->returnValue($createRoute));
+ ->willReturn($createRoute);
$router
->expects($this->at(3))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.update'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($updateRoute));
+ ->willReturn($updateRoute);
$router
->expects($this->at(4))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.destroy'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($destroyRoute));
+ ->willReturn($destroyRoute);
// load route configuration
$config = new RouteConfig($container, $router, $yaml);
@@ -448,20 +448,20 @@ private function mockRoute(
->expects($this->exactly(1))
->method('method')
->with($this->equalTo($verb))
- ->will($this->returnValue($route));
+ ->willReturn($route);
$route
->expects($this->exactly(1))
->method('action')
->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName)))
- ->will($this->returnValue($route));
+ ->willReturn($route);
if(count($requirements) > 0) {
$route
->expects($this->exactly(1))
->method('requirements')
->with($this->equalTo($requirements))
- ->will($this->returnValue($route));
+ ->willReturn($route);
}
if (count($defaults) > 0) {
@@ -469,7 +469,7 @@ private function mockRoute(
->expects($this->exactly(1))
->method('defaults')
->with($this->equalTo($defaults))
- ->will($this->returnValue($route));
+ ->willReturn($route);
}
return $route;
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 412db90849b70..3ec70d7142afd 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -469,7 +469,7 @@ public function testEnabledApps($user, $expectedApps, $forceAll) {
$this->setupAppConfigMock()->expects($this->once())
->method('getValues')
- ->will($this->returnValue(
+ ->willReturn(
array(
'app3' => 'yes',
'app2' => 'no',
@@ -478,7 +478,7 @@ public function testEnabledApps($user, $expectedApps, $forceAll) {
'appforgroup2' => '["group2"]',
'appforgroup12' => '["group2","group1"]',
)
- )
+
);
$apps = \OC_App::getEnabledApps(false, $forceAll);
@@ -508,12 +508,12 @@ public function testEnabledAppsCache() {
$this->setupAppConfigMock()->expects($this->once())
->method('getValues')
- ->will($this->returnValue(
+ ->willReturn(
array(
'app3' => 'yes',
'app2' => 'no',
)
- )
+
);
$apps = \OC_App::getEnabledApps();
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index b4e5e097847bf..a128768031766 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -64,7 +64,7 @@ protected function setUp(): void {
$this->time = 1313131;
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnValue($this->time));
+ ->willReturn($this->time);
$this->tokenProvider = new DefaultTokenProvider($this->mapper, $this->crypto, $this->config, $this->logger,
$this->timeFactory);
@@ -96,11 +96,11 @@ public function testGenerateToken() {
$this->config->expects($this->any())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('encrypt')
->with($password, $token . '1f4h9s')
- ->will($this->returnValue('encryptedpassword'));
+ ->willReturn('encryptedpassword');
$this->mapper->expects($this->once())
->method('insert')
->with($this->equalTo($toInsert));
@@ -136,7 +136,7 @@ public function testGetTokenByUser() {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
- ->will($this->returnValue(['token']));
+ ->willReturn(['token']);
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
@@ -148,11 +148,11 @@ public function testGetPassword() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('decrypt')
->with('someencryptedvalue', $token . '1f4h9s')
- ->will($this->returnValue('passme'));
+ ->willReturn('passme');
$actual = $this->tokenProvider->getPassword($tk, $token);
@@ -188,7 +188,7 @@ public function testGetPasswordDeletesInvalidToken() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('decrypt')
->with('someencryptedvalue', $token . '1f4h9s')
@@ -208,11 +208,11 @@ public function testSetPassword() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('ocsecret'));
+ ->willReturn('ocsecret');
$this->crypto->expects($this->once())
->method('encrypt')
->with($password, $tokenId . 'ocsecret')
- ->will($this->returnValue('encryptedpassword'));
+ ->willReturn('encryptedpassword');
$this->mapper->expects($this->once())
->method('update')
->with($token);
@@ -256,10 +256,10 @@ public function testInvalidateOldTokens() {
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
$this->config->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
- ]));
+ ]);
$this->mapper->expects($this->at(0))
->method('invalidateOld')
->with($this->time - 150);
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 3fa7a92bb9b97..c9dc3d6ef4a9d 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -61,12 +61,12 @@ protected function setUp(): void {
$this->crypto = \OC::$server->getCrypto();
$this->config = $this->createMock(IConfig::class);
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', 60 * 60 * 24, 150],
['remember_login_cookie_lifetime', 60 * 60 * 24 * 15, 300],
['secret', '', '1f4h9s'],
['openssl', [], []],
- ]));
+ ]);
$this->logger = $this->createMock(ILogger::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->time = 1313131;
@@ -124,7 +124,7 @@ public function testGetTokenByUser() {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
- ->will($this->returnValue(['token']));
+ ->willReturn(['token']);
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
@@ -239,10 +239,10 @@ public function testInvalidateOldTokens() {
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
$this->config->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
- ]));
+ ]);
$this->mapper->expects($this->at(0))
->method('invalidateOld')
->with($this->time - 150);
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index 63d0e993f3b57..b5cea26e73f13 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -126,7 +126,7 @@ protected function setUp(): void {
private function prepareNoProviders() {
$this->providerLoader->method('getProviders')
->with($this->user)
- ->will($this->returnValue([]));
+ ->willReturn([]);
}
private function prepareProviders() {
@@ -366,11 +366,11 @@ public function testVerifyChallenge() {
$this->fakeProvider->expects($this->once())
->method('verifyChallenge')
->with($this->user, $challenge)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->once())
->method('get')
->with('two_factor_remember_login')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->at(1))
->method('remove')
->with('two_factor_auth_uid');
@@ -449,7 +449,7 @@ public function testVerifyInvalidChallenge() {
$this->fakeProvider->expects($this->once())
->method('verifyChallenge')
->with($this->user, $challenge)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->never())
->method('remove');
$this->activityManager->expects($this->once())
@@ -496,7 +496,7 @@ public function testNeedsSecondFactor() {
$this->session->expects($this->at(1))
->method('exists')
->with('two_factor_auth_uid')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->at(2))
->method('exists')
->with(Manager::SESSION_UID_DONE)
@@ -557,7 +557,7 @@ public function testNeedsSecondFactorWithNoProviderAvailableAnymore() {
$this->session->expects($this->never())
->method('exists')
->with('two_factor_auth_uid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->never())
->method('remove')
->with('two_factor_auth_uid');
@@ -567,7 +567,7 @@ public function testNeedsSecondFactorWithNoProviderAvailableAnymore() {
public function testPrepareTwoFactorLogin() {
$this->user->method('getUID')
- ->will($this->returnValue('ferdinand'));
+ ->willReturn('ferdinand');
$this->session->expects($this->at(0))
->method('set')
@@ -597,7 +597,7 @@ public function testPrepareTwoFactorLogin() {
public function testPrepareTwoFactorLoginDontRemember() {
$this->user->method('getUID')
- ->will($this->returnValue('ferdinand'));
+ ->willReturn('ferdinand');
$this->session->expects($this->at(0))
->method('set')
@@ -630,14 +630,14 @@ public function testNeedsSecondFactorSessionAuth() {
->willReturn('user');
$this->session->method('exists')
- ->will($this->returnCallback(function ($var) {
+ ->willReturnCallback(function ($var) {
if ($var === Manager::SESSION_UID_KEY) {
return false;
} else if ($var === 'app_password') {
return false;
}
return true;
- }));
+ });
$this->session->expects($this->once())
->method('get')
->with(Manager::SESSION_UID_DONE)
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
index f37629768371c..60635d488776d 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
@@ -63,14 +63,14 @@ public function testFailHardIfProviderCanNotBeLoaded() {
->willReturn(['mail', 'twofactor_totp']);
$this->appManager
->method('getAppInfo')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail', false, null, []],
['twofactor_totp', false, null, [
'two-factor-providers' => [
'\\OCA\\MyFaulty2faApp\\DoesNotExist',
],
]],
- ]));
+ ]);
$this->loader->getProviders($this->user);
}
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index 43e325b09412c..11bb33a974184 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -57,18 +57,18 @@ public function testGetNoAvatar() {
->willReturn($file);
$this->folder->method('getFile')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'avatar.64.png') {
throw new NotFoundException();
}
- }));
+ });
$this->folder->method('fileExists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'generated') {
return true;
}
return false;
- }));
+ });
$data = NULL;
$file->method('putContent')
@@ -85,10 +85,10 @@ public function testGetNoAvatar() {
public function testGetAvatarSizeMatch() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
['avatar.128.jpg', true],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -102,9 +102,9 @@ public function testGetAvatarSizeMatch() {
public function testGetAvatarSizeMinusOne() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -118,10 +118,10 @@ public function testGetAvatarSizeMinusOne() {
public function testGetAvatarNoSizeMatch() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.png', true],
['avatar.32.png', false],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -133,7 +133,7 @@ public function testGetAvatarNoSizeMatch() {
$file->method('getContent')->willReturn($expected->data());
$this->folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($path) use ($file) {
if ($path === 'avatar.png') {
return $file;
@@ -141,7 +141,7 @@ function($path) use ($file) {
throw new \OCP\Files\NotFoundException;
}
}
- ));
+ );
$newFile = $this->createMock(File::class);
$newFile->expects($this->once())
@@ -164,19 +164,19 @@ public function testExistsNo() {
public function testExiststJPG() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
['avatar.png', false],
- ]));
+ ]);
$this->assertTrue($this->avatar->exists());
}
public function testExistsPNG() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', false],
['avatar.png', true],
- ]));
+ ]);
$this->assertTrue($this->avatar->exists());
}
@@ -282,7 +282,7 @@ private function getUserAvatar($user)
{
/** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */
$l = $this->createMock(IL10N::class);
- $l->method('t')->will($this->returnArgument(0));
+ $l->method('t')->willReturnArgument(0);
return new \OC\Avatar\UserAvatar(
$this->folder,
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 7e099b23d063b..6e99a71d1e337 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -150,7 +150,7 @@ public function testGetLastJob() {
$this->config->expects($this->once())
->method('getAppValue')
->with('backgroundjob', 'lastjob', 0)
- ->will($this->returnValue(15));
+ ->willReturn(15);
$this->assertEquals(15, $this->instance->getLastJob());
}
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php
index 450bdf607b3cc..cadeb502b4fb9 100644
--- a/tests/lib/Cache/FileCacheTest.php
+++ b/tests/lib/Cache/FileCacheTest.php
@@ -127,11 +127,11 @@ public function testGarbageCollectOldKeys() {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$mockStorage->expects($this->once())
->method('unlink')
->with('key1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->instance->set('key1', 'value1');
$this->instance->gc();
@@ -142,7 +142,7 @@ public function testGarbageCollectLeaveRecentKeys() {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(time() + 3600));
+ ->willReturn(time() + 3600);
$mockStorage->expects($this->never())
->method('unlink')
->with('key1');
@@ -165,7 +165,7 @@ public function testGarbageCollectIgnoreLockedKeys($testException) {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$mockStorage->expects($this->atLeastOnce())
->method('unlink')
->will($this->onConsecutiveCalls(
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index fa459203dace2..5f98188799b52 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -44,19 +44,19 @@ protected function setUp(): void {
public function testSearch($search1, $search2, $expected) {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('simple:1'));
+ $calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
->method('search')
->with('', [], [], null, null)
- ->will($this->returnValue($search1));
+ ->willReturn($search1);
/** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('simple:2'));
+ $calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
->method('search')
->with('', [], [], null, null)
- ->will($this->returnValue($search2));
+ ->willReturn($search2);
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -71,21 +71,21 @@ public function testSearch($search1, $search2, $expected) {
public function testSearchOptions($search1, $search2, $expected) {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('simple:1'));
+ $calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
->method('search')
->with('searchTerm', ['SUMMARY', 'DESCRIPTION'],
['timerange' => ['start' => null, 'end' => null]], 5, 20)
- ->will($this->returnValue($search1));
+ ->willReturn($search1);
/** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('simple:2'));
+ $calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
->method('search')
->with('searchTerm', ['SUMMARY', 'DESCRIPTION'],
['timerange' => ['start' => null, 'end' => null]], 5, 20)
- ->will($this->returnValue($search2));
+ ->willReturn($search2);
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -152,11 +152,11 @@ public function searchProvider() {
public function testRegisterUnregister() {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('key1'));
+ $calendar1->method('getKey')->willReturn('key1');
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('key2'));
+ $calendar2->method('getKey')->willReturn('key2');
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -176,11 +176,11 @@ public function testRegisterUnregister() {
public function testGetCalendars() {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('key1'));
+ $calendar1->method('getKey')->willReturn('key1');
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('key2'));
+ $calendar2->method('getKey')->willReturn('key2');
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
diff --git a/tests/lib/Calendar/Resource/ManagerTest.php b/tests/lib/Calendar/Resource/ManagerTest.php
index 71679a86a8cfd..30b0e16c948ef 100644
--- a/tests/lib/Calendar/Resource/ManagerTest.php
+++ b/tests/lib/Calendar/Resource/ManagerTest.php
@@ -45,18 +45,18 @@ protected function setUp(): void {
public function testRegisterUnregisterBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
@@ -74,18 +74,18 @@ public function testRegisterUnregisterBackend() {
public function testGetBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
@@ -96,18 +96,18 @@ public function testGetBackend() {
public function testClear() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
diff --git a/tests/lib/Calendar/Room/ManagerTest.php b/tests/lib/Calendar/Room/ManagerTest.php
index 56f05544e2928..b01d16945ad2e 100644
--- a/tests/lib/Calendar/Room/ManagerTest.php
+++ b/tests/lib/Calendar/Room/ManagerTest.php
@@ -45,18 +45,18 @@ protected function setUp(): void {
public function testRegisterUnregisterBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
@@ -74,18 +74,18 @@ public function testRegisterUnregisterBackend() {
public function testGetBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
@@ -96,18 +96,18 @@ public function testGetBackend() {
public function testClear() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php
index 6fa86a2e855f6..594d17168d6fb 100644
--- a/tests/lib/Command/Integrity/SignAppTest.php
+++ b/tests/lib/Command/Integrity/SignAppTest.php
@@ -59,17 +59,17 @@ public function testExecuteWithMissingPath() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('PrivateKey'));
+ ->willReturn('PrivateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -87,17 +87,17 @@ public function testExecuteWithMissingPrivateKey() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -115,17 +115,17 @@ public function testExecuteWithMissingCertificate() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$outputInterface
->expects($this->at(0))
@@ -143,23 +143,23 @@ public function testExecuteWithNotExistingPrivateKey() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -177,28 +177,28 @@ public function testExecuteWithNotExistingCertificate() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key');
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with('certificate')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -216,17 +216,17 @@ public function testExecuteWithException() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -260,17 +260,17 @@ public function testExecute() {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php
index 9bab016ec8f2b..36376ef0e7dd4 100644
--- a/tests/lib/Command/Integrity/SignCoreTest.php
+++ b/tests/lib/Command/Integrity/SignCoreTest.php
@@ -54,12 +54,12 @@ public function testExecuteWithMissingPrivateKey() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -77,12 +77,12 @@ public function testExecuteWithMissingCertificate() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$outputInterface
->expects($this->at(0))
@@ -100,23 +100,23 @@ public function testExecuteWithNotExistingPrivateKey() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -134,17 +134,17 @@ public function testExecuteWithNotExistingCertificate() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -155,7 +155,7 @@ public function testExecuteWithNotExistingCertificate() {
->expects($this->at(1))
->method('file_get_contents')
->with('certificate')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -173,17 +173,17 @@ public function testExecuteWithException() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -217,17 +217,17 @@ public function testExecute() {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 93cafc0f93366..1700af797fed2 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -339,7 +339,7 @@ public function testGetNumberOfUnreadCommentsForFolder() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('comment_test'));
+ ->willReturn('comment_test');
$manager = $this->getManager();
@@ -679,7 +679,7 @@ public function testSetMarkRead() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
@@ -696,7 +696,7 @@ public function testSetMarkReadUpdate() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime('yesterday');
@@ -716,7 +716,7 @@ public function testReadMarkDeleteUser() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
@@ -734,7 +734,7 @@ public function testReadMarkDeleteObject() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
index 10584812c41e3..8df04086ab6c2 100644
--- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
@@ -80,10 +80,10 @@ public function testGetProviders() {
]);
$this->serverContainer->expects($this->exactly(2))
->method('query')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[EMailProvider::class, true, $provider1],
['OCA\Contacts\Provider1', true, $provider2]
- ]));
+ ]);
$providers = $this->actionProviderStore->getProviders($user);
@@ -105,9 +105,9 @@ public function testGetProvidersOfAppWithIncompleInfo() {
->willReturn([/* Empty info.xml */]);
$this->serverContainer->expects($this->once())
->method('query')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[EMailProvider::class, true, $provider1],
- ]));
+ ]);
$providers = $this->actionProviderStore->getProviders($user);
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php
index 9e8b75fbf4db2..f39d849bb9551 100644
--- a/tests/lib/ContactsManagerTest.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -227,10 +227,10 @@ public function testAddressBookEnumeration() {
// setup return for method calls
$addressbook->expects($this->any())
->method('getKey')
- ->will($this->returnValue('SIMPLE_ADDRESS_BOOK'));
+ ->willReturn('SIMPLE_ADDRESS_BOOK');
$addressbook->expects($this->any())
->method('getDisplayName')
- ->will($this->returnValue('A very simple Addressbook'));
+ ->willReturn('A very simple Addressbook');
// register the address book
$this->cm->registerAddressBook($addressbook);
diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php
index 3b44f15f7568e..5698ad966f195 100644
--- a/tests/lib/DB/MDB2SchemaReaderTest.php
+++ b/tests/lib/DB/MDB2SchemaReaderTest.php
@@ -38,10 +38,10 @@ protected function getConfig() {
->getMock();
$config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array('dbname', 'owncloud', 'testDB'),
array('dbtableprefix', 'oc_', 'test_')
- )));
+ ));
return $config;
}
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index 31936a4176bc6..b333729ef87a3 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -335,7 +335,7 @@ public function testRenameKeys($source, $target, $systemWideMountSource, $system
->willReturn(true);
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
@@ -366,7 +366,7 @@ public function testCopyKeys($source, $target, $systemWideMountSource, $systemWi
->willReturn(true);
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
@@ -432,7 +432,7 @@ public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $e
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturn($systemWideMountPoint);
@@ -460,7 +460,7 @@ public function testKeySetPreparation() {
->willReturn(false);
$this->view->expects($this->any())
->method('mkdir')
- ->will($this->returnCallback(array($this, 'mkdirCallback')));
+ ->willReturnCallback(array($this, 'mkdirCallback'));
$this->mkdirStack = array(
'/user1/files_encryption/keys/foo',
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index e503da109a81d..2c5bd1a80f35b 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -120,7 +120,7 @@ public function testIsExcluded($path, $keyStorageRoot, $expected) {
$this->userManager
->expects($this->any())
->method('userExists')
- ->will($this->returnCallback(array($this, 'isExcludedCallback')));
+ ->willReturnCallback(array($this, 'isExcludedCallback'));
$this->assertSame($expected,
$this->util->isExcluded($path)
diff --git a/tests/lib/FileChunkingTest.php b/tests/lib/FileChunkingTest.php
index 75a6913d4ad8d..7cbabe697a46c 100644
--- a/tests/lib/FileChunkingTest.php
+++ b/tests/lib/FileChunkingTest.php
@@ -61,10 +61,10 @@ public function testIsComplete($total, array $present, $expected) {
$cache->expects($this->atLeastOnce())
->method('hasKey')
- ->will($this->returnCallback(function ($key) use ($present) {
+ ->willReturnCallback(function ($key) use ($present) {
$data = explode('-', $key);
return in_array($data[3], $present);
- }));
+ });
$fileChunking->method('getCache')->willReturn($cache);
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index b2816c0309479..247ed9ef9ec65 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -544,7 +544,7 @@ public function testWithoutNormalizer() {
$cacheMock->expects($this->any())
->method('normalize')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php
index 2f61f634ffb6e..6f347a504cbe1 100644
--- a/tests/lib/Files/Config/UserMountCacheTest.php
+++ b/tests/lib/Files/Config/UserMountCacheTest.php
@@ -77,24 +77,24 @@ private function getStorage($storageId) {
->getMock();
$storageCache->expects($this->any())
->method('getNumericId')
- ->will($this->returnValue($storageId));
+ ->willReturn($storageId);
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
->disableOriginalConstructor()
->getMock();
$cache->expects($this->any())
->method('getId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
->method('getStorageCache')
- ->will($this->returnValue($storageCache));
+ ->willReturn($storageCache);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
return [$storage, $rootId];
}
@@ -401,7 +401,7 @@ public function testGetMountsForFileIdSubFolderMount() {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -434,7 +434,7 @@ public function testGetMountsForFileIdSubFolderMountOutside() {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -481,11 +481,11 @@ public function testGetUsedSpaceForUsers() {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$mount1->expects($this->any())
->method('getNumericStorageId')
- ->will($this->returnValue(2));
+ ->willReturn(2);
$this->cache->registerMounts($user1, [$mount1]);
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index 9b63c507b5fc6..800b360415acf 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -21,12 +21,12 @@ public function testGetStorage() {
$storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mountPoint = new \OC\Files\Mount\MountPoint(
// just use this because a real class is needed
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 2cdf9cbdc5a25..69d31b28a963d 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -48,12 +48,12 @@ public function testGetContent() {
$this->view->expects($this->once())
->method('file_get_contents')
->with('/bar/foo')
- ->will($this->returnValue('bar'));
+ ->willReturn('bar');
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('bar', $node->getContent());
@@ -70,12 +70,12 @@ public function testGetContentNotPermitted() {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->getContent();
@@ -89,17 +89,17 @@ public function testPutContent() {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$this->view->expects($this->once())
->method('file_put_contents')
->with('/bar/foo', 'bar')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -117,7 +117,7 @@ public function testPutContentNotPermitted() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -132,7 +132,7 @@ public function testGetMimeType() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('mimetype' => 'text/plain')));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('text/plain', $node->getMimeType());
@@ -162,12 +162,12 @@ public function testFOpenRead() {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'r')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('r');
@@ -197,12 +197,12 @@ public function testFOpenWrite() {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'w')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('w');
@@ -232,7 +232,7 @@ public function testFOpenReadNotPermitted() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('r');
@@ -257,7 +257,7 @@ public function testFOpenReadWriteNoReadPermissions() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
@@ -282,7 +282,7 @@ public function testFOpenReadWriteNoWritePermissions() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index d33fb4f68f88e..979c7fd6da631 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -59,15 +59,15 @@ public function testGetDirectoryContent() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->any())
->method('getDirectoryContent')
->with('/bar/foo')
- ->will($this->returnValue(array(
+ ->willReturn(array(
new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null),
new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null)
- )));
+ ));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$children = $node->getDirectoryListing();
@@ -91,7 +91,7 @@ public function testGet() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -112,14 +112,14 @@ public function testNodeExists() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
$root->expects($this->once())
->method('get')
->with('/bar/foo/asd')
- ->will($this->returnValue($child));
+ ->willReturn($child);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertTrue($node->nodeExists('asd'));
@@ -136,7 +136,7 @@ public function testNodeExistsNotExists() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -158,17 +158,17 @@ public function testNewFolder() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('mkdir')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
@@ -190,12 +190,12 @@ public function testNewFolderNotPermitted() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFolder('asd');
@@ -212,17 +212,17 @@ public function testNewFile() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('touch')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\File($root, $view, '/bar/foo/asd');
@@ -244,12 +244,12 @@ public function testNewFileNotPermitted() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFile('asd');
@@ -266,12 +266,12 @@ public function testGetFreeSpace() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('free_space')
->with('/bar/foo')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertEquals(100, $node->getFreeSpace());
@@ -288,39 +288,39 @@ public function testSearch() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->search('qw');
@@ -340,7 +340,7 @@ public function testSearchInRoot() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/** @var \PHPUnit_Framework_MockObject_MockObject|Storage $storage */
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
@@ -349,32 +349,32 @@ public function testSearchInRoot() {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
array('fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$result = $root->search('qw');
$this->assertEquals(1, count($result));
@@ -392,7 +392,7 @@ public function testSearchInStorageRoot() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -400,31 +400,31 @@ public function testSearchInStorageRoot() {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue(''));
+ ->willReturn('');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->search('qw');
@@ -443,7 +443,7 @@ public function testSearchSubStorages() {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -454,50 +454,50 @@ public function testSearchSubStorages() {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$subMount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($subStorage));
+ ->willReturn($subStorage);
$subMount->expects($this->once())
->method('getMountPoint')
- ->will($this->returnValue('/bar/foo/bar/'));
+ ->willReturn('/bar/foo/bar/');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$subStorage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($subCache));
+ ->willReturn($subCache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$subCache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($subMount)));
+ ->willReturn(array($subMount));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
@@ -534,34 +534,34 @@ public function testGetById() {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -588,29 +588,29 @@ public function testGetByIdMountRoot() {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->getById(1);
@@ -637,34 +637,34 @@ public function testGetByIdOutsideFolder() {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -691,12 +691,12 @@ public function testGetByIdMultipleStorages() {
$storage->expects($this->exactly(2))
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([
+ ->willReturn([
new CachedMountInfo(
$this->user,
1,
@@ -713,26 +713,26 @@ public function testGetByIdMultipleStorages() {
1,
''
)
- ]));
+ ]);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->any())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->any())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($mount2)));
+ ->willReturn(array($mount2));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount1));
+ ->willReturn($mount1);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -767,14 +767,14 @@ public function testGetUniqueName($name, $existingFiles, $expected) {
$view->expects($this->any())
->method('file_exists')
- ->will($this->returnCallback(function ($path) use ($existingFiles, $folderPath) {
+ ->willReturnCallback(function ($path) use ($existingFiles, $folderPath) {
foreach ($existingFiles as $existing) {
if ($folderPath . '/' . $existing === $path) {
return true;
}
}
return false;
- }));
+ });
$node = new \OC\Files\Node\Folder($root, $view, $folderPath);
$this->assertEquals($expected, $node->getNonExistingName($name));
@@ -802,7 +802,7 @@ public function testRecent() {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -866,7 +866,7 @@ public function testRecentFolder() {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -932,7 +932,7 @@ public function testRecentJail() {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 7c8ddee6b5f6a..18cc4d8057480 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -92,7 +92,7 @@ protected function getMockStorage() {
->getMock();
$storage->expects($this->any())
->method('getId')
- ->will($this->returnValue('home::someuser'));
+ ->willReturn('home::someuser');
return $storage;
}
@@ -103,20 +103,20 @@ protected function getFileInfo($data) {
public function testDelete() {
$this->root->expects($this->exactly(2))
->method('emit')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -163,17 +163,17 @@ public function testDeleteHooks() {
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain'])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain']));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue([null, 'foo']));
+ ->willReturn([null, 'foo']);
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->delete();
@@ -186,12 +186,12 @@ public function testDeleteNotPermitted() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -201,7 +201,7 @@ public function testDeleteNotPermitted() {
public function testStat() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = array(
'fileid' => 1,
@@ -214,7 +214,7 @@ public function testStat() {
$this->view->expects($this->once())
->method('stat')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals($stat, $node->stat());
@@ -223,7 +223,7 @@ public function testStat() {
public function testGetId() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -235,7 +235,7 @@ public function testGetId() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(1, $node->getId());
@@ -244,7 +244,7 @@ public function testGetId() {
public function testGetSize() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
@@ -257,7 +257,7 @@ public function testGetSize() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(100, $node->getSize());
@@ -266,7 +266,7 @@ public function testGetSize() {
public function testGetEtag() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -278,7 +278,7 @@ public function testGetEtag() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('qwerty', $node->getEtag());
@@ -287,7 +287,7 @@ public function testGetEtag() {
public function testGetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -299,7 +299,7 @@ public function testGetMTime() {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(50, $node->getMTime());
@@ -308,7 +308,7 @@ public function testGetMTime() {
public function testGetStorage() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -319,7 +319,7 @@ public function testGetStorage() {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -329,7 +329,7 @@ public function testGetStorage() {
public function testGetPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('/bar/foo', $node->getPath());
@@ -338,7 +338,7 @@ public function testGetPath() {
public function testGetInternalPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -349,7 +349,7 @@ public function testGetInternalPath() {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -359,7 +359,7 @@ public function testGetInternalPath() {
public function testGetName() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('foo', $node->getName());
@@ -368,17 +368,17 @@ public function testGetName() {
public function testTouchSetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -420,17 +420,17 @@ public function testTouchHooks() {
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array(null, 'foo')));
+ ->willReturn(array(null, 'foo'));
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->touch(100);
@@ -443,12 +443,12 @@ public function testTouchNotPermitted() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -466,11 +466,11 @@ public function testCopySameStorage() {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
@@ -478,10 +478,10 @@ public function testCopySameStorage() {
$this->root->expects($this->exactly(2))
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar/asd', $newNode],
['/bar', $parentNode]
- ]));
+ ]);
$target = $node->copy('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -505,16 +505,16 @@ public function testCopyNotPermitted() {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -548,9 +548,9 @@ public function testCopyParentIsFile() {
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -559,18 +559,18 @@ public function testMoveSameStorage() {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$target = $node->move('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -602,11 +602,11 @@ public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $
$this->view->expects($this->any())
->method($viewMethod)
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
/**
* @var \OC\Files\Node\File|\PHPUnit_Framework_MockObject_MockObject $node
@@ -617,7 +617,7 @@ public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $
$root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]);
$hooksRun = 0;
@@ -665,7 +665,7 @@ public function testMoveNotPermitted() {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$this->view->expects($this->never())
->method('rename');
@@ -676,7 +676,7 @@ public function testMoveNotPermitted() {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -716,7 +716,7 @@ public function testMoveParentIsFile() {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -728,18 +728,18 @@ public function testMoveFailed() {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->move('/bar/asd');
}
@@ -751,18 +751,18 @@ public function testCopyFailed() {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->copy('/bar/asd');
}
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 5067236ec5827..6c4189bdec7c9 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -79,7 +79,7 @@ public function testGet() {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain')));
$root->mount($storage, '');
$node = $root->get('/bar/foo');
@@ -115,7 +115,7 @@ public function testGetNotFound() {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$root->mount($storage, '');
$root->get('/bar/foo');
diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
index 0061ca3910ed5..164541b670cb0 100644
--- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php
+++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
@@ -82,7 +82,7 @@ public function testFreeSpaceWithUnknownDiskSpace() {
->getMock();
$storage->expects($this->any())
->method('free_space')
- ->will($this->returnValue(-2));
+ ->willReturn(-2);
$storage->getScanner()->scan('');
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
@@ -138,7 +138,7 @@ public function testReturnFalseWhenFopenFailed() {
->getMock();
$failStorage->expects($this->any())
->method('fopen')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $failStorage, 'quota' => 1000));
@@ -189,14 +189,14 @@ public function testSpaceRoot() {
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$storage->expects($this->once())
->method('free_space')
- ->will($this->returnValue(2048));
+ ->willReturn(2048);
$cache->expects($this->once())
->method('get')
->with('files')
- ->will($this->returnValue(new CacheEntry(['size' => 50])));
+ ->willReturn(new CacheEntry(['size' => 50]));
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files'));
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index fd5e8c6ca9d6b..09333a86144dc 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -99,10 +99,10 @@ public function testStreamOpen($isMasterKeyUsed,
$fileMock->expects($this->never())->method('getAccessList');
} else {
$fileMock->expects($this->once())->method('getAccessList')
- ->will($this->returnCallback(function ($sharePath) use ($expectedSharePath) {
+ ->willReturnCallback(function ($sharePath) use ($expectedSharePath) {
$this->assertSame($expectedSharePath, $sharePath);
return array();
- }));
+ });
}
$utilMock = $this->getMockBuilder('\OC\Encryption\Util')
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index 01f11bf39c8d1..3befe64c82552 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -240,14 +240,14 @@ public function testMimeTypeIcon() {
[$this->equalTo('core'), $this->equalTo('filetypes/my-type.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/my.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/my.png') {
return 'my.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('my-type');
@@ -271,14 +271,14 @@ function($appName, $file) {
[$this->equalTo('core'), $this->equalTo('filetypes/foo.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/file.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/file.png') {
return 'file.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('foo-bar');
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php
index 44422cd97d131..9d82e4ae1e1dc 100644
--- a/tests/lib/Files/Utils/ScannerTest.php
+++ b/tests/lib/Files/Utils/ScannerTest.php
@@ -117,13 +117,13 @@ public function testScanSubMount() {
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
+ ->willReturnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
if ($user->getUID() === $uid) {
return [$mount];
} else {
return [];
}
- }));
+ });
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
$cache = $storage->getCache();
@@ -199,9 +199,9 @@ public function testSkipLocalShares() {
$sharedStorage->expects($this->any())
->method('instanceOfStorage')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[SharedStorage::class, true],
- ]));
+ ]);
$sharedStorage->expects($this->never())
->method('getScanner');
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 5705005937550..5f3116e7b2428 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -1169,11 +1169,11 @@ private function doTestCopyRenameFail($operation) {
$storage2->expects($this->any())
->method('fopen')
- ->will($this->returnCallback(function ($path, $mode) use ($storage2) {
+ ->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);
- }));
+ });
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
@@ -1220,7 +1220,7 @@ public function testDeleteFailKeepCache() {
->getMock();
$storage->expects($this->once())
->method('unlink')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$scanner = $storage->getScanner();
$cache = $storage->getCache();
$storage->file_put_contents('foo.txt', 'asd');
@@ -1597,7 +1597,7 @@ private function createTestMovableMountPoints($mountPoints) {
$mountProvider = $this->createMock(IMountProvider::class);
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnValue($mounts));
+ ->willReturn($mounts);
$mountProviderCollection = \OC::$server->getMountProviderCollection();
$mountProviderCollection->registerProvider($mountProvider);
@@ -1617,11 +1617,11 @@ public function testMountPointMove() {
]);
$mount1->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$mount2->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$view = new View('/' . $this->user . '/files/');
$view->mkdir('sub');
@@ -1846,13 +1846,13 @@ public function testLockBasicOperation(
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $lockedPath, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $lockedPath);
return true;
}
- ));
+ );
$this->assertNull($this->getFileLockType($view, $lockedPath), 'File not locked before operation');
@@ -1890,13 +1890,13 @@ public function testLockFilePutContentWithStream() {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1929,13 +1929,13 @@ public function testLockFopen() {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1990,11 +1990,11 @@ public function testLockBasicOperationUnlocksAfterException(
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception('Simulated exception');
}
- ));
+ );
$thrown = false;
try {
@@ -2102,7 +2102,7 @@ public function testLockFileRename($operation, $expectedLockTypeSourceDuring) {
$storage->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'target.txt';
@@ -2113,14 +2113,14 @@ public function testLockFileRename($operation, $expectedLockTypeSourceDuring) {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($operation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($operation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2166,11 +2166,11 @@ public function testLockFileCopyException() {
$storage->expects($this->once())
->method('copy')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception();
}
- ));
+ );
$this->connectMockHooks('copy', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks('copy', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2282,7 +2282,7 @@ public function testLockFileRenameCrossStorage($viewOperation, $storageOperation
$storage2->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'substorage/target.txt';
@@ -2296,14 +2296,14 @@ public function testLockFileRenameCrossStorage($viewOperation, $storageOperation
->method($storageOperation);
$storage2->expects($this->once())
->method($storageOperation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($viewOperation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($viewOperation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2343,7 +2343,7 @@ public function testLockMoveMountPoint() {
$mount->expects($this->once())
->method('moveMount')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true);
@@ -2354,7 +2354,7 @@ function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourc
return true;
}
- ));
+ );
$this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost, true);
$this->connectMockHooks('rename', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost, true);
@@ -2408,18 +2408,18 @@ private function connectMockHooks($hookType, $view, $path, &$lockTypePre, &$lock
$eventHandler->expects($this->any())
->method('preCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePre) {
$lockTypePre = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
$eventHandler->expects($this->any())
->method('postCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePost) {
$lockTypePost = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
if ($hookType !== null) {
Util::connectHook(
diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php
index 61e4b39c8f308..554432a2c865b 100644
--- a/tests/lib/Group/GroupTest.php
+++ b/tests/lib/Group/GroupTest.php
@@ -56,11 +56,11 @@ protected function getUserManager() {
$user3 = $this->newUser('user3', $backend);
$userManager->expects($this->any())
->method('get')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array('user1', $user1),
array('user2', $user2),
array('user3', $user3)
- )));
+ ));
return $userManager;
}
@@ -74,7 +74,7 @@ public function testGetUsersSingleBackend() {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user1', 'user2')));
+ ->willReturn(array('user1', 'user2'));
$users = $group->getUsers();
@@ -98,12 +98,12 @@ public function testGetUsersMultipleBackends() {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user1', 'user2')));
+ ->willReturn(array('user1', 'user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user2', 'user3')));
+ ->willReturn(array('user2', 'user3'));
$users = $group->getUsers();
@@ -129,7 +129,7 @@ public function testInGroupSingleBackend() {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
@@ -150,12 +150,12 @@ public function testInGroupMultipleBackends() {
$backend1->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend2->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
@@ -173,10 +173,10 @@ public function testAddUser() {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('addToGroup')
@@ -198,10 +198,10 @@ public function testAddUserAlreadyInGroup() {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('addToGroup');
@@ -222,10 +222,10 @@ public function testRemoveUser() {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('removeFromGroup')
@@ -247,10 +247,10 @@ public function testRemoveUserNotInGroup() {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('removeFromGroup');
@@ -274,10 +274,10 @@ public function testRemoveUserMultipleBackends() {
$backend1->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->once())
->method('removeFromGroup')
@@ -286,10 +286,10 @@ public function testRemoveUserMultipleBackends() {
$backend2->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('removeFromGroup')
@@ -308,7 +308,7 @@ public function testSearchUsers() {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('2');
@@ -330,11 +330,11 @@ public function testSearchUsersMultipleBackends() {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('2');
@@ -353,7 +353,7 @@ public function testSearchUsersLimitAndOffset() {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 1, 1)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('user', 1, 1);
@@ -375,11 +375,11 @@ public function testSearchUsersMultipleBackendsLimitAndOffset() {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 2, 1)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 2, 1)
- ->will($this->returnValue(array('user1')));
+ ->willReturn(array('user1'));
$users = $group->searchUsers('user', 2, 1);
@@ -400,11 +400,11 @@ public function testCountUsers() {
$backend1->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(3));
+ ->willReturn(3);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$users = $group->count('2');
@@ -424,18 +424,18 @@ public function testCountUsersMultipleBackends() {
$backend1->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(3));
+ ->willReturn(3);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(4));
+ ->willReturn(4);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$users = $group->count('2');
@@ -453,7 +453,7 @@ public function testCountUsersNoMethod() {
->method('countUsersInGroup');
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$users = $group->count('2');
@@ -472,7 +472,7 @@ public function testDelete() {
->with('group1');
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$group->delete();
}
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index d5f8baa3fa1b7..8385c924edfff 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -52,10 +52,10 @@ private function getTestUser($userId) {
$mockUser = $this->createMock(IUser::class);
$mockUser->expects($this->any())
->method('getUID')
- ->will($this->returnValue($userId));
+ ->willReturn($userId);
$mockUser->expects($this->any())
->method('getDisplayName')
- ->will($this->returnValue($userId));
+ ->willReturn($userId);
return $mockUser;
}
@@ -91,9 +91,9 @@ private function getTestBackend($implementedActions = null) {
->getMock();
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function($actions) use ($implementedActions) {
+ ->willReturnCallback(function($actions) use ($implementedActions) {
return (bool)($actions & $implementedActions);
- }));
+ });
return $backend;
}
@@ -105,7 +105,7 @@ public function testGet() {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -129,7 +129,7 @@ public function testGetNotExists() {
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -157,7 +157,7 @@ public function testGetMultipleBackends() {
$backend1->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -166,7 +166,7 @@ public function testGetMultipleBackends() {
$backend2->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -184,15 +184,15 @@ public function testCreate() {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnCallback(function () use (&$backendGroupCreated) {
+ ->willReturnCallback(function () use (&$backendGroupCreated) {
return $backendGroupCreated;
- }));
+ });
$backend->expects($this->once())
->method('createGroup')
- ->will($this->returnCallback(function () use (&$backendGroupCreated) {
+ ->willReturnCallback(function () use (&$backendGroupCreated) {
$backendGroupCreated = true;
return true;
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -236,7 +236,7 @@ public function testCreateExists() {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('createGroup');
@@ -255,11 +255,11 @@ public function testSearch() {
$backend->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -278,10 +278,10 @@ public function testSearchMultipleBackends() {
$backend1->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -290,10 +290,10 @@ public function testSearchMultipleBackends() {
$backend2->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group12', 'group1')));
+ ->willReturn(array('group12', 'group1'));
$backend2->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -315,10 +315,10 @@ public function testSearchMultipleBackendsLimitAndOffset() {
$backend1->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -327,10 +327,10 @@ public function testSearchMultipleBackendsLimitAndOffset() {
$backend2->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
- ->will($this->returnValue(array('group12')));
+ ->willReturn(array('group12'));
$backend2->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -350,11 +350,11 @@ public function testSearchResultExistsButGroupDoesNot() {
$backend->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(['group1']));
+ ->willReturn(['group1']);
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @var \OC\User\Manager $userManager */
$userManager = $this->createMock(Manager::class);
@@ -374,11 +374,11 @@ public function testGetUserGroups() {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -421,11 +421,11 @@ public function testGetUserGroupsWithDeletedGroup() {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -448,10 +448,10 @@ public function testInGroup() {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'admin', 'group2')));
+ ->willReturn(array('group1', 'admin', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -467,10 +467,10 @@ public function testIsAdmin() {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'admin', 'group2')));
+ ->willReturn(array('group1', 'admin', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -486,10 +486,10 @@ public function testNotAdmin() {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -505,10 +505,10 @@ public function testGetUserGroupsMultipleBackends() {
$backend1->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -517,10 +517,10 @@ public function testGetUserGroupsMultipleBackends() {
$backend2->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -542,11 +542,11 @@ public function testDisplayNamesInGroupWithOneUserBackend() {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid, $gid) {
+ ->willReturnCallback(function($uid, $gid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -555,22 +555,22 @@ public function testDisplayNamesInGroupWithOneUserBackend() {
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 : return ['user3' => $this->getTestUser('user3'),
'user33' => $this->getTestUser('user33')];
case 2 : return [];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -579,7 +579,7 @@ public function testDisplayNamesInGroupWithOneUserBackend() {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -600,11 +600,11 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid, $gid) {
+ ->willReturnCallback(function($uid, $gid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -614,22 +614,22 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 : return ['user3' => $this->getTestUser('user3'),
'user33' => $this->getTestUser('user33')];
case 2 : return ['user333' => $this->getTestUser('user333')];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -639,7 +639,7 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -661,11 +661,11 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpeci
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -675,12 +675,12 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpeci
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 :
return [
@@ -690,10 +690,10 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpeci
];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -703,7 +703,7 @@ public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpeci
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -725,16 +725,16 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', -1, 0)
- ->will($this->returnValue(array('user2', 'user33')));
+ ->willReturn(array('user2', 'user33'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -743,7 +743,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -764,16 +764,16 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitS
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', 1, 0)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -782,7 +782,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitS
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -803,16 +803,16 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitA
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', 1, 1)
- ->will($this->returnValue(array('user33')));
+ ->willReturn(array('user33'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -821,7 +821,7 @@ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitA
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -843,13 +843,13 @@ public function testGetUserGroupsWithAddUser() {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnCallback(function () use (&$expectedGroups) {
+ ->willReturnCallback(function () use (&$expectedGroups) {
return $expectedGroups;
- }));
+ });
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -880,19 +880,19 @@ public function testGetUserGroupsWithRemoveUser() {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnCallback(function () use (&$expectedGroups) {
+ ->willReturnCallback(function () use (&$expectedGroups) {
return $expectedGroups;
- }));
+ });
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('inGroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('removeFromGroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -922,7 +922,7 @@ public function testGetUserIdGroups() {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -945,10 +945,10 @@ public function testGroupDisplayName() {
);
$backend->expects($this->any())
->method('getGroupDetails')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['group1', ['gid' => 'group1', 'displayName' => 'Group One']],
['group2', ['gid' => 'group2']],
- ]));
+ ]);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php
index 4332a6f036f57..ebd9cd79f238a 100644
--- a/tests/lib/Group/MetaDataTest.php
+++ b/tests/lib/Group/MetaDataTest.php
@@ -83,7 +83,7 @@ public function testGet() {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get();
@@ -103,7 +103,7 @@ public function testGetWithSorting() {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get();
@@ -121,7 +121,7 @@ public function testGetWithCache() {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
//two calls, if caching fails call counts for group and groupmanager
//are exceeded
@@ -137,7 +137,7 @@ public function testGetGroupsAsAdmin() {
->expects($this->once())
->method('search')
->with('Foo')
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$expected = ['DummyValue'];
$this->assertSame($expected, $this->invokePrivate($this->groupMetadata, 'getGroups', ['Foo']));
diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php
index 7b2fb6657331c..29250109d0220 100644
--- a/tests/lib/HelperStorageTest.php
+++ b/tests/lib/HelperStorageTest.php
@@ -71,7 +71,7 @@ private function getStorageMock($freeSpace = 12) {
$this->storageMock->expects($this->once())
->method('free_space')
- ->will($this->returnValue(12));
+ ->willReturn(12);
return $this->storageMock;
}
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 586a42ff54713..22b026eaae524 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -62,13 +62,13 @@ protected function setUp(): void {
$this->mimeTypeDetector = $this->createMock(\OC\Files\Type\Detection::class);
$this->config->method('getAppValue')
- ->will($this->returnArgument(2));
+ ->willReturnArgument(2);
$this->cacheFactory
->expects($this->any())
->method('createDistributed')
->with('oc.integritycheck.checker')
- ->will($this->returnValue(new NullCache()));
+ ->willReturn(new NullCache());
$this->checker = new Checker(
$this->environmentHelper,
@@ -161,12 +161,12 @@ public function testVerifyAppSignatureWithoutSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -181,18 +181,18 @@ public function testVerifyAppSignatureWithValidSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -207,14 +207,14 @@ public function testVerifyAppSignatureWithValidSignatureData() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@@ -223,18 +223,18 @@ public function testVerifyAppSignatureWithTamperedSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -249,14 +249,14 @@ public function testVerifyAppSignatureWithTamperedSignatureData() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -271,18 +271,18 @@ public function testVerifyAppSignatureWithTamperedFiles() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -297,14 +297,14 @@ public function testVerifyAppSignatureWithTamperedFiles() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
@@ -335,12 +335,12 @@ public function testVerifyAppSignatureWithTamperedFilesAndAlternatePath() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->never())
@@ -360,14 +360,14 @@ public function testVerifyAppSignatureWithTamperedFilesAndAlternatePath() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
@@ -398,18 +398,18 @@ public function testVerifyAppWithDifferentScope() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -422,14 +422,14 @@ public function testVerifyAppWithDifferentScope() {
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json')
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -444,18 +444,18 @@ public function testVerifyAppWithDifferentScopeAndAlwaysTrustedCore() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -468,14 +468,14 @@ public function testVerifyAppWithDifferentScopeAndAlwaysTrustedCore() {
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json')
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@@ -540,7 +540,7 @@ public function testWriteCoreSignature() {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -575,7 +575,7 @@ public function testWriteCoreSignatureWithUnmodifiedHtaccess() {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -640,7 +640,7 @@ public function testWriteCoreSignatureWithValidModifiedHtaccess() {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -667,12 +667,12 @@ public function testVerifyCoreSignatureWithoutSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -687,17 +687,17 @@ public function testVerifyCoreSignatureWithValidSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -712,14 +712,14 @@ public function testVerifyCoreSignatureWithValidSignatureData() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -728,17 +728,17 @@ public function testVerifyCoreSignatureWithValidModifiedHtaccessSignatureData()
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
$signatureDataFile = '{
"hashes": {
".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
@@ -753,14 +753,14 @@ public function testVerifyCoreSignatureWithValidModifiedHtaccessSignatureData()
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -769,12 +769,12 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->mimeTypeDetector
->expects($this->once())
@@ -994,7 +994,7 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified');
$signatureDataFile = '{
"hashes": {
"mimetypelist.js": "dc48de7ad4baa030c5e563350c9a80b274bad783f6f5adbf1595ecef6c6a32e52890a24cb26cddb0aa20193ba52c001150c68d8bfb567f0aed566f4029a190a3"
@@ -1008,14 +1008,14 @@ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -1025,17 +1025,17 @@ public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrd
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1050,14 +1050,14 @@ public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrd
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -1066,17 +1066,17 @@ public function testVerifyCoreSignatureWithTamperedSignatureData() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -1091,14 +1091,14 @@ public function testVerifyCoreSignatureWithTamperedSignatureData() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1113,17 +1113,17 @@ public function testVerifyCoreSignatureWithTamperedFiles() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1138,14 +1138,14 @@ public function testVerifyCoreSignatureWithTamperedFiles() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'INVALID_HASH' => [
@@ -1175,17 +1175,17 @@ public function testVerifyCoreWithInvalidCertificate() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1200,14 +1200,14 @@ public function testVerifyCoreWithInvalidCertificate() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1222,17 +1222,17 @@ public function testVerifyCoreWithDifferentScope() {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1247,14 +1247,14 @@ public function testVerifyCoreWithDifferentScope() {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1289,17 +1289,17 @@ public function testRunInstanceVerification() {
$this->appLocator
->expects($this->at(0))
->method('getAllApps')
- ->will($this->returnValue([
+ ->willReturn([
'files',
'calendar',
'contacts',
'dav',
- ]));
+ ]);
$this->appManager
->expects($this->at(0))
->method('isShipped')
->with('files')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(1))
->method('verifyAppSignature')
@@ -1308,17 +1308,17 @@ public function testRunInstanceVerification() {
->expects($this->at(1))
->method('isShipped')
->with('calendar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->at(1))
->method('getAppPath')
->with('calendar')
- ->will($this->returnValue('/apps/calendar'));
+ ->willReturn('/apps/calendar');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_exists')
->with('/apps/calendar/appinfo/signature.json')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(2))
->method('verifyAppSignature')
@@ -1327,22 +1327,22 @@ public function testRunInstanceVerification() {
->expects($this->at(2))
->method('isShipped')
->with('contacts')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->at(2))
->method('getAppPath')
->with('contacts')
- ->will($this->returnValue('/apps/contacts'));
+ ->willReturn('/apps/contacts');
$this->fileAccessHelper
->expects($this->at(1))
->method('file_exists')
->with('/apps/contacts/appinfo/signature.json')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isShipped')
->with('dav')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(3))
->method('verifyAppSignature')
@@ -1359,12 +1359,12 @@ public function testVerifyAppSignatureWithoutSignatureDataAndCodeCheckerDisabled
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = [];
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
@@ -1389,12 +1389,12 @@ public function testIsCodeCheckEnforced($channel, $isCodeSigningEnforced) {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue($channel));
+ ->willReturn($channel);
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertSame($isCodeSigningEnforced, $this->checker->isCodeCheckEnforced());
}
@@ -1407,12 +1407,12 @@ public function testIsCodeCheckEnforcedWithDisabledConfigSwitch($channel) {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue($channel));
+ ->willReturn($channel);
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertFalse(self::invokePrivate($this->checker, 'isCodeCheckEnforced'));
}
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index c75bfba5b99cc..4d35aeabc9147 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -510,7 +510,7 @@ public function testFindLanguage($loggedIn, $availableLang, $expected) {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) use ($defaultLang) {
+ ->willReturnCallback(function($var, $default) use ($defaultLang) {
if ($var === 'installed') {
return true;
} else if ($var === 'default_language') {
@@ -518,7 +518,7 @@ public function testFindLanguage($loggedIn, $availableLang, $expected) {
} else {
return $default;
}
- }));
+ });
if ($loggedIn) {
$user = $this->getMockBuilder(IUser::class)
@@ -549,14 +549,14 @@ public function testFindLanguage($loggedIn, $availableLang, $expected) {
$factory = $this->getFactory(['languageExists', 'findAvailableLanguages', 'respectDefaultLanguage']);
$factory->expects($this->any())
->method('languageExists')
- ->will($this->returnCallback(function ($app, $lang) use ($availableLang) {
+ ->willReturnCallback(function ($app, $lang) use ($availableLang) {
return in_array($lang, $availableLang);
- }));
+ });
$factory->expects($this->any())
->method('findAvailableLanguages')
- ->will($this->returnCallback(function ($app) use ($availableLang) {
+ ->willReturnCallback(function ($app) use ($availableLang) {
return $availableLang;
- }));
+ });
$factory->expects($this->any())
->method('respectDefaultLanguage')->willReturnCallback(function($app, $lang) {
return $lang;
diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php
index 21d5dbc8babe1..e023819a08893 100644
--- a/tests/lib/LegacyHelperTest.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -112,56 +112,56 @@ function testBuildNotExistingFileNameForView() {
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename.ext exists
+ ->willReturn(true); // filename.ext exists
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename.ext exists
+ ->willReturn(true); // filename.ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (1).ext exists
+ ->willReturn(true); // filename (1).ext exists
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (3).ext exists
+ ->willReturn(true); // filename (3).ext exists
$this->assertEquals('dir/filename (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1).ext exists
+ ->willReturn(true); // filename(1).ext exists
$this->assertEquals('dir/filename(2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (1).ext exists
+ ->willReturn(true); // filename(1) (1).ext exists
$this->assertEquals('dir/filename(1) (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (1).ext exists
+ ->willReturn(true); // filename(1) (1).ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (2).ext exists
+ ->willReturn(true); // filename(1) (2).ext exists
$this->assertEquals('dir/filename(1) (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (2) (3).ext exists
+ ->willReturn(true); // filename(1) (2) (3).ext exists
$this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock));
}
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php
index 73a7b6c3f83ae..ac58538284c22 100644
--- a/tests/lib/Lock/DBLockingProviderTest.php
+++ b/tests/lib/Lock/DBLockingProviderTest.php
@@ -54,9 +54,9 @@ protected function setUp(): void {
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnCallback(function () {
+ ->willReturnCallback(function () {
return $this->currentTime;
- }));
+ });
parent::setUp();
}
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 1d19929fe0086..bc451f833f2f4 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -81,10 +81,10 @@ public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam) {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
- ]));
+ ]);
$path = \OC_Helper::findBinaryPath('sendmail');
if ($path === null) {
@@ -104,10 +104,10 @@ public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'qmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
- ]));
+ ]);
$this->assertEquals(new \Swift_SendmailTransport('/var/qmail/bin/sendmail' . $binaryParam), self::invokePrivate($this->mailer, 'getSendMailInstance'));
}
@@ -121,10 +121,10 @@ public function testGetInstanceDefault() {
public function testGetInstanceSendmail() {
$this->config
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', 'smtp'],
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertInstanceOf(\Swift_Mailer::class, $mailer);
@@ -151,7 +151,7 @@ public function testCreateMessage() {
->expects($this->any())
->method('getSystemValue')
->with('mail_send_plaintext_only', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage());
}
@@ -163,7 +163,7 @@ public function testSendInvalidMailException() {
->disableOriginalConstructor()->getMock();
$message->expects($this->once())
->method('getSwiftMessage')
- ->will($this->returnValue(new \Swift_Message()));
+ ->willReturn(new \Swift_Message());
$this->mailer->send($message);
}
@@ -199,10 +199,10 @@ public function testCreateEMailTemplate() {
public function testStreamingOptions() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], ['foo' => 1]]
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertEquals(1, count($mailer->getTransport()->getStreamOptions()));
$this->assertTrue(isset($mailer->getTransport()->getStreamOptions()['foo']));
@@ -211,10 +211,10 @@ public function testStreamingOptions() {
public function testStreamingOptionsWrongType() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], 'bar']
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertEquals(0, count($mailer->getTransport()->getStreamOptions()));
}
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index ab62cfcfdcbed..14c243450699c 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -80,7 +80,7 @@ public function testGetFrom($swiftresult, $return) {
$this->swiftMessage
->expects($this->once())
->method('getFrom')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getFrom());
}
@@ -117,7 +117,7 @@ public function testGetTo($swiftresult,$return) {
$this->swiftMessage
->expects($this->once())
->method('getTo')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getTo());
}
@@ -137,7 +137,7 @@ public function testGetCc($swiftresult,$return) {
$this->swiftMessage
->expects($this->once())
->method('getCc')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getCc());
}
@@ -157,7 +157,7 @@ public function testGetBcc($swiftresult,$return) {
$this->swiftMessage
->expects($this->once())
->method('getBcc')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getBcc());
}
@@ -175,7 +175,7 @@ public function testGetSubject() {
$this->swiftMessage
->expects($this->once())
->method('getSubject')
- ->will($this->returnValue('Fancy Subject'));
+ ->willReturn('Fancy Subject');
$this->assertSame('Fancy Subject', $this->message->getSubject());
}
@@ -193,7 +193,7 @@ public function testGetPlainBody() {
$this->swiftMessage
->expects($this->once())
->method('getBody')
- ->will($this->returnValue('Fancy Body'));
+ ->willReturn('Fancy Body');
$this->assertSame('Fancy Body', $this->message->getPlainBody());
}
diff --git a/tests/lib/Memcache/CasTraitTest.php b/tests/lib/Memcache/CasTraitTest.php
index 2f0ef939aa706..619721538868e 100644
--- a/tests/lib/Memcache/CasTraitTest.php
+++ b/tests/lib/Memcache/CasTraitTest.php
@@ -33,27 +33,27 @@ private function getCache() {
$mock->expects($this->any())
->method('set')
- ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) {
+ ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) {
return $sourceCache->set($key, $value, $ttl);
- }));
+ });
$mock->expects($this->any())
->method('get')
- ->will($this->returnCallback(function ($key) use ($sourceCache) {
+ ->willReturnCallback(function ($key) use ($sourceCache) {
return $sourceCache->get($key);
- }));
+ });
$mock->expects($this->any())
->method('add')
- ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) {
+ ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) {
return $sourceCache->add($key, $value, $ttl);
- }));
+ });
$mock->expects($this->any())
->method('remove')
- ->will($this->returnCallback(function ($key) use ($sourceCache) {
+ ->willReturnCallback(function ($key) use ($sourceCache) {
return $sourceCache->remove($key);
- }));
+ });
return $mock;
}
diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php
index 7ee802e54fb4c..3a78793f91d90 100644
--- a/tests/lib/OCS/ProviderTest.php
+++ b/tests/lib/OCS/ProviderTest.php
@@ -44,22 +44,22 @@ public function testBuildProviderListWithoutAnythingEnabled() {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -85,22 +85,22 @@ public function testBuildProviderListWithSharingEnabled() {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -139,22 +139,22 @@ public function testBuildProviderListWithFederationEnabled() {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -187,7 +187,7 @@ public function testBuildProviderListWithEverythingEnabled() {
$this->appManager
->expects($this->any())
->method('isEnabledForUser')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index cfb78a05da5e8..f5a3f9a1bf038 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -147,9 +147,9 @@ public function testGetNewPreview() {
->willReturn($previewFolder);
$this->config->method('getSystemValue')
- ->will($this->returnCallback(function($key, $defult) {
+ ->willReturnCallback(function($key, $defult) {
return $defult;
- }));
+ });
$invalidProvider = $this->createMock(IProviderV2::class);
$invalidProvider->method('isAvailable')
@@ -169,7 +169,7 @@ public function testGetNewPreview() {
]);
$this->helper->method('getProvider')
- ->will($this->returnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) {
+ ->willReturnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) {
if ($provider === 'wrongProvider') {
$this->fail('Wrongprovider should not be constructed!');
} else if ($provider === 'brokenProvider') {
@@ -182,7 +182,7 @@ public function testGetNewPreview() {
return $unavailableProvider;
}
$this->fail('Unexpected provider requested');
- }));
+ });
$image = $this->createMock(IImage::class);
$image->method('width')->willReturn(2048);
@@ -191,13 +191,13 @@ public function testGetNewPreview() {
$image->method('dataMimeType')->willReturn('image/png');
$this->helper->method('getThumbnail')
- ->will($this->returnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) {
+ ->willReturnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) {
if ($provider === $validProvider) {
return $image;
} else {
return false;
}
- }));
+ });
$image->method('data')
->willReturn('my data');
@@ -211,14 +211,14 @@ public function testGetNewPreview() {
$previewFolder->method('getDirectoryListing')
->willReturn([]);
$previewFolder->method('newFile')
- ->will($this->returnCallback(function($filename) use ($maxPreview, $previewFile) {
+ ->willReturnCallback(function($filename) use ($maxPreview, $previewFile) {
if ($filename === '2048-2048-max.png') {
return $maxPreview;
} else if ($filename === '256-256.png') {
return $previewFile;
}
$this->fail('Unexpected file');
- }));
+ });
$maxPreview->expects($this->once())
->method('putContent')
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index 1baaf89e0a02e..ed25a81ca1f14 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -40,7 +40,7 @@ protected function setUp(): void {
$config->expects($this->any())
->method('getSystemValue')
->with('version')
- ->will($this->returnValue('12.0.0.0'));
+ ->willReturn('12.0.0.0');
$this->connection = \OC::$server->getDatabaseConnection();
$this->deleteAllShares();
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index 013e170cc9df9..d7525a09b1887 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -46,7 +46,7 @@ protected function setUp(): void {
$config->expects($this->any())
->method('getSystemValue')
->with('version')
- ->will($this->returnValue('11.0.0.0'));
+ ->willReturn('11.0.0.0');
$this->storage = new \OC\Files\Storage\Temporary([]);
diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php
index 433a161e8fa0b..bc1671d9178f8 100644
--- a/tests/lib/RepairStepTest.php
+++ b/tests/lib/RepairStepTest.php
@@ -93,7 +93,7 @@ public function testRunRepairStepsWithException() {
->will($this->throwException(new \Exception()));
$mock->expects($this->any())
->method('getName')
- ->will($this->returnValue('Exception Test'));
+ ->willReturn('Exception Test');
$this->repair->addStep($mock);
$this->repair->addStep(new TestRepairStep(false));
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index 048540fb5a59f..5e0db3bf24c79 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -185,7 +185,7 @@ private function isIpWhiteListedHelper($ip,
->willReturn($enabled);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) use ($whitelists) {
+ ->willReturnCallback(function($app, $key, $default) use ($whitelists) {
if ($app !== 'bruteForce') {
return $default;
}
@@ -193,7 +193,7 @@ private function isIpWhiteListedHelper($ip,
return $whitelists[$key];
}
return $default;
- }));
+ });
$this->assertSame(
($enabled === false) ? true : $isWhiteListed,
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index 0b93c704b5c1b..5ebcac7756a03 100644
--- a/tests/lib/Security/CredentialsManagerTest.php
+++ b/tests/lib/Security/CredentialsManagerTest.php
@@ -54,7 +54,7 @@ private function getQueryResult($row) {
$result->expects($this->any())
->method('fetch')
- ->will($this->returnValue($row));
+ ->willReturn($row);
return $result;
}
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index f3ee14dead1cb..2796dead0e287 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -34,11 +34,11 @@ public function testIsTrustedDomain($trustedDomains, $testDomain, $result) {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config->expects($this->at(1))
->method('getSystemValue')
->with('trusted_domains')
- ->will($this->returnValue($trustedDomains));
+ ->willReturn($trustedDomains);
$trustedDomainHelper = new TrustedDomainHelper($this->config);
$this->assertEquals($result, $trustedDomainHelper->isTrustedDomain($testDomain));
@@ -122,7 +122,7 @@ public function testIsTrustedDomainOverwriteHost() {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('myproxyhost'));
+ ->willReturn('myproxyhost');
$trustedDomainHelper = new TrustedDomainHelper($this->config);
$this->assertTrue($trustedDomainHelper->isTrustedDomain('myproxyhost'));
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index bce547c9a29a2..f83bf99f3153a 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -96,7 +96,7 @@ public function testGetPersonalSectionsEmptySection() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->assertEquals([], $this->manager->getPersonalSections());
}
@@ -195,7 +195,7 @@ public function testSameSectionAsPersonalAndAdmin() {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index 7ab3eb78539a0..0890b70dfcd29 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -56,17 +56,17 @@ public function testGetSupportedDatabasesWithOneWorking() {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'oci']
- ));
+ );
$this->setupClass
->expects($this->once())
->method('is_callable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue(['sqlite']));
+ ->willReturn(['sqlite']);
$result = $this->setupClass->getSupportedDatabases();
$expectedResult = [
'sqlite' => 'SQLite'
@@ -79,17 +79,17 @@ public function testGetSupportedDatabasesWithNoWorking() {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'oci', 'pgsql']
- ));
+ );
$this->setupClass
->expects($this->any())
->method('is_callable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$result = $this->setupClass->getSupportedDatabases();
$this->assertSame([], $result);
@@ -99,17 +99,17 @@ public function testGetSupportedDatabasesWithAllWorking() {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'pgsql', 'oci']
- ));
+ );
$this->setupClass
->expects($this->any())
->method('is_callable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue(['sqlite', 'mysql', 'pgsql']));
+ ->willReturn(['sqlite', 'mysql', 'pgsql']);
$result = $this->setupClass->getSupportedDatabases();
$expectedResult = [
'sqlite' => 'SQLite',
@@ -128,7 +128,7 @@ public function testGetSupportedDatabaseException() {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue('NotAnArray'));
+ ->willReturn('NotAnArray');
$this->setupClass->getSupportedDatabases();
}
@@ -143,7 +143,7 @@ public function testFindWebRootCli($url, $expected) {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue($url));
+ ->willReturn($url);
\OC::$CLI = true;
try {
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index ff3cafbdf7ccf..396f0cbad844c 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -179,9 +179,9 @@ public function testGetShareByIdUserShare() {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -301,9 +301,9 @@ public function testGetShareByIdGroupShare() {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -334,13 +334,13 @@ public function testGetShareByIdUserGroupShare() {
$node = $this->createMock(Folder::class);
$node->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user0')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user0')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$node]);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$this->groupManager->method('get')->with('group0')->willReturn($group0);
$share = $this->provider->getShareById($id, 'user1');
@@ -384,9 +384,9 @@ public function testGetShareByIdLinkShare() {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -599,9 +599,9 @@ public function testGetChildren() {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $ownerFolder],
- ]));
+ ]);
$share = $this->createMock(IShare::class);
$share->method('getId')->willReturn($id);
@@ -647,10 +647,10 @@ public function testCreateUserShare() {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -703,10 +703,10 @@ public function testCreateGroupShare() {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -760,10 +760,10 @@ public function testCreateLinkShare() {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -822,7 +822,7 @@ public function testGetShareByToken() {
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
$share = $this->provider->getShareByToken('secrettoken');
@@ -913,7 +913,7 @@ public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2)
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -990,7 +990,7 @@ public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2)
$this->groupManager->method('get')->with('sharedWith')->willReturn($group);
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -1081,7 +1081,7 @@ public function testGetSharedWithGroupUserModified($storageStringId, $fileName1,
$this->groupManager->method('get')->with('sharedWith')->willReturn($group);
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -1124,7 +1124,7 @@ public function testGetSharedWithUserWithNode($storageStringId, $fileName1, $fil
$file = $this->createMock(File::class);
$file->method('getId')->willReturn($fileId2);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $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);
@@ -1169,7 +1169,7 @@ public function testGetSharedWithGroupWithNode($storageStringId, $fileName1, $fi
$node = $this->createMock(Folder::class);
$node->method('getId')->willReturn($fileId2);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $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);
@@ -1220,7 +1220,7 @@ public function testGetSharedWithWithDeletedFile($shareType, $trashed) {
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]);
$groups = [];
@@ -1285,7 +1285,7 @@ public function testGetSharesBy() {
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -1335,7 +1335,7 @@ public function testGetSharesNode() {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -1385,7 +1385,7 @@ public function testGetSharesReshare() {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $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);
@@ -1431,10 +1431,10 @@ public function testDeleteFromSelfGroupNoCustomShare() {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1444,7 +1444,7 @@ public function testDeleteFromSelfGroupNoCustomShare() {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1502,10 +1502,10 @@ public function testDeleteFromSelfGroupAlreadyCustomShare() {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1515,7 +1515,7 @@ public function testDeleteFromSelfGroupAlreadyCustomShare() {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1562,10 +1562,10 @@ public function testDeleteFromSelfGroupUserNotInGroup() {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1575,7 +1575,7 @@ public function testDeleteFromSelfGroupUserNotInGroup() {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1607,17 +1607,17 @@ public function testDeleteFromSelfGroupDoesNotExist() {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$this->groupManager->method('get')->with('group')->willReturn(null);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1647,15 +1647,15 @@ public function testDeleteFromSelfUser() {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1701,15 +1701,15 @@ public function testDeleteFromSelfUserNotRecipient() {
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1739,14 +1739,14 @@ public function testDeleteFromSelfLink() {
$user1 = $this->createMock(IUser::class);
$user1->method('getUID')->willReturn('user1');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1766,10 +1766,10 @@ public function testUpdateUser() {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1782,10 +1782,10 @@ public function testUpdateUser() {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1823,10 +1823,10 @@ public function testUpdateLink() {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1839,10 +1839,10 @@ public function testUpdateLink() {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1889,10 +1889,10 @@ public function testUpdateLinkRemovePassword() {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1905,10 +1905,10 @@ public function testUpdateLinkRemovePassword() {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1946,10 +1946,10 @@ public function testUpdateGroupNoSub() {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$groups = [];
@@ -1959,10 +1959,10 @@ public function testUpdateGroupNoSub() {
$groups['group'.$i] = $group;
}
- $this->groupManager->method('get')->will(
- $this->returnCallback(function($groupId) use ($groups) {
+ $this->groupManager->method('get')->willReturnCallback(
+ function($groupId) use ($groups) {
return $groups[$groupId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1975,10 +1975,10 @@ public function testUpdateGroupNoSub() {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -2024,10 +2024,10 @@ public function testUpdateGroupSubShares() {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$groups = [];
@@ -2037,10 +2037,10 @@ public function testUpdateGroupSubShares() {
$groups['group'.$i] = $group;
}
- $this->groupManager->method('get')->will(
- $this->returnCallback(function($groupId) use ($groups) {
+ $this->groupManager->method('get')->willReturnCallback(
+ function($groupId) use ($groups) {
return $groups[$groupId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -2053,10 +2053,10 @@ public function testUpdateGroupSubShares() {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -2118,15 +2118,15 @@ public function testMoveUserShare() {
$user1->method('getUID')->willReturn('user1');
$user1->method('getDisplayName')->willReturn('user1');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$file]);
$share = $this->provider->getShareById($id, null);
@@ -2153,15 +2153,15 @@ public function testMoveGroupShare() {
$this->groupManager->method('get')->with('group0')->willReturn($group0);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$folder = $this->createMock(Folder::class);
$folder->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$folder]);
$share = $this->provider->getShareById($id, 'user0');
@@ -2845,7 +2845,7 @@ public function testGetAllShares() {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap(
+ ->willReturnMap(
[
['shareOwner1', $shareOwner1Folder],
['shareOwner2', $shareOwner2Folder],
@@ -2853,7 +2853,7 @@ public function testGetAllShares() {
['shareOwner4', $shareOwner4Folder],
['shareOwner5', $shareOwner5Folder],
]
- ));
+ );
$shares = iterator_to_array($this->provider->getAllShares());
$this->assertEquals(4, count($shares));
diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php
index 14fe32323c1ab..2b062e592ba9b 100644
--- a/tests/lib/Share20/LegacyHooksTest.php
+++ b/tests/lib/Share20/LegacyHooksTest.php
@@ -281,10 +281,10 @@ public function testPreShareError() {
->expects($this->exactly(1))
->method('preShare')
->with($expected)
- ->will($this->returnCallback(function ($data) {
+ ->willReturnCallback(function ($data) {
$data['run'] = false;
$data['error'] = 'I error';
- }));
+ });
$event = new GenericEvent($share);
$this->eventDispatcher->dispatch('OCP\Share::preShare', $event);
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 314038fe13b2c..e46e019c6ed84 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -123,9 +123,9 @@ protected function setUp(): void {
$this->l10nFactory = $this->createMock(IFactory::class);
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->factory = new DummyFactory(\OC::$server);
@@ -334,11 +334,11 @@ public function testDeleteNested() {
$this->defaultProvider
->method('getChildren')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[$share1, [$share2]],
[$share2, [$share3]],
[$share3, []],
- ]));
+ ]);
$this->defaultProvider
->method('delete')
@@ -423,12 +423,12 @@ public function testDeleteChildren() {
$this->defaultProvider
->expects($this->exactly(4))
->method('getChildren')
- ->will($this->returnCallback(function($_share) use ($share, $shares) {
+ ->willReturnCallback(function($_share) use ($share, $shares) {
if ($_share === $share) {
return $shares;
}
return [];
- }));
+ });
$this->defaultProvider
->expects($this->exactly(3))
@@ -483,26 +483,26 @@ public function testVerifyPasswordNullButEnforced() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Passwords are enforced for link shares');
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'verifyPassword', [null]);
}
public function testVerifyPasswordNull() {
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$result = self::invokePrivate($this->manager, 'verifyPassword', [null]);
$this->assertNull($result);
}
public function testVerifyPasswordHook() {
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$this->eventDispatcher->expects($this->once())->method('dispatch')
->willReturnCallback(function(Event $event) {
@@ -521,9 +521,9 @@ public function testVerifyPasswordHookFails() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('password not accepted');
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$this->eventDispatcher->expects($this->once())->method('dispatch')
->willReturnCallback(function(Event $event) {
@@ -697,14 +697,14 @@ public function dataGeneralChecks() {
public function testGeneralChecks($share, $exceptionMessage, $exception) {
$thrown = null;
- $this->userManager->method('userExists')->will($this->returnValueMap([
+ $this->userManager->method('userExists')->willReturnMap([
['user0', true],
['user1', true],
- ]));
+ ]);
- $this->groupManager->method('groupExists')->will($this->returnValueMap([
+ $this->groupManager->method('groupExists')->willReturnMap([
['group0', true],
- ]));
+ ]);
$userFolder = $this->createMock(Folder::class);
$userFolder->method('getPath')->willReturn('myrootfolder');
@@ -735,10 +735,10 @@ public function testGeneralCheckShareRoot() {
$thrown = null;
- $this->userManager->method('userExists')->will($this->returnValueMap([
+ $this->userManager->method('userExists')->willReturnMap([
['user0', true],
['user1', true],
- ]));
+ ]);
$userFolder = $this->createMock(Folder::class);
$userFolder->method('isSubNode')->with($userFolder)->willReturn(false);
@@ -779,10 +779,10 @@ public function testvalidateExpirationDateEnforceButNotSet() {
$share->setProviderId('foo')->setId('bar');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
@@ -792,9 +792,9 @@ public function testvalidateExpirationDateEnforceButNotEnabledAndNotSet() {
$share->setProviderId('foo')->setId('bar');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -805,11 +805,11 @@ public function testvalidateExpirationDateEnforceButNotSetNewShare() {
$share = $this->manager->newShare();
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
['core', 'shareapi_default_expire_date', 'no', 'yes'],
- ]));
+ ]);
$expected = new \DateTime();
$expected->setTime(0,0,0);
@@ -830,10 +830,10 @@ public function testvalidateExpirationDateEnforceToFarIntoFuture() {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
try {
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -858,10 +858,10 @@ public function testvalidateExpirationDateEnforceValid() {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
@@ -921,10 +921,10 @@ public function testvalidateExpirationDateNoDateDefault() {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
@@ -946,9 +946,9 @@ public function testValidateExpirationDateHookModification() {
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
- $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) {
+ $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
$data['expirationDate']->sub(new \DateInterval('P2D'));
- }));
+ });
$share = $this->manager->newShare();
$share->setExpirationDate($nextWeek);
@@ -973,10 +973,10 @@ public function testValidateExpirationDateHookException() {
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
- $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) {
+ $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
$data['accepted'] = false;
$data['message'] = 'Invalid date!';
- }));
+ });
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
@@ -987,10 +987,10 @@ public function testValidateExpirationDateExistingShareNoDefault() {
$share->setId('42')->setProviderId('foo');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '6'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -1010,23 +1010,23 @@ public function testUserCreateChecksShareWithGroupMembersOnlyDifferentGroups() {
$this->groupManager
->method('getUserGroupIds')
- ->will(
- $this->returnValueMap([
+ ->willReturnMap(
+ [
[$sharedBy, ['group1']],
[$sharedWith, ['group2']],
- ])
+ ]
);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['sharedBy', $sharedBy],
['sharedWith', $sharedWith],
- ]));
+ ]);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'userCreateChecks', [$share]);
}
@@ -1043,23 +1043,23 @@ public function testUserCreateChecksShareWithGroupMembersOnlySharedGroup() {
$this->groupManager
->method('getUserGroupIds')
- ->will(
- $this->returnValueMap([
+ ->willReturnMap(
+ [
[$sharedBy, ['group1', 'group3']],
[$sharedWith, ['group2', 'group3']],
- ])
+ ]
);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['sharedBy', $sharedBy],
['sharedWith', $sharedWith],
- ]));
+ ]);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
- ]));
+ ]);
$this->defaultProvider
->method('getSharesByPath')
@@ -1215,9 +1215,9 @@ public function testGroupCreateChecksShareWithGroupMembersGroupSharingNotAllowed
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'no'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1240,10 +1240,10 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1263,10 +1263,10 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
$this->assertNull($this->invokePrivate($this->manager, 'groupCreateChecks', [$share]));
}
@@ -1292,10 +1292,10 @@ public function testGroupCreateChecksShareWithGroupMembersOnlyInGroup() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1325,9 +1325,9 @@ public function testGroupCreateChecksPathAlreadySharedWithSameGroup() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1349,9 +1349,9 @@ public function testGroupCreateChecksPathAlreadySharedWithDifferentGroup() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1366,9 +1366,9 @@ public function testLinkCreateChecksNoLinkSharesAllowed() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'no'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1384,9 +1384,9 @@ public function testLinkCreateChecksSharePermissions() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1402,10 +1402,10 @@ public function testLinkCreateChecksNoPublicUpload() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'no']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1417,10 +1417,10 @@ public function testLinkCreateChecksPublicUpload() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'yes']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1433,10 +1433,10 @@ public function testLinkCreateChecksReadOnly() {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'no']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1525,10 +1525,10 @@ public function testIsSharingDisabledForUser($excludeGroups, $groupList, $setLis
$user = $this->createMock(IUser::class);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_exclude_groups', 'no', $excludeGroups],
['core', 'shareapi_exclude_groups_list', '', $groupList],
- ]));
+ ]);
if ($setList !== null) {
$this->config->expects($this->once())
@@ -1573,9 +1573,9 @@ public function dataCanShare() {
*/
public function testCanShare($expected, $sharingEnabled, $disabledForUser) {
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enabled', 'yes', $sharingEnabled],
- ]));
+ ]);
$manager = $this->createManagerMock()
->setMethods(['sharingDisabledForUser'])
@@ -1639,7 +1639,7 @@ public function testCreateShareUser() {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -1692,7 +1692,7 @@ public function testCreateShareGroup() {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -1773,9 +1773,9 @@ public function testCreateShareLink() {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnCallback(function(Share $share) {
+ ->willReturnCallback(function(Share $share) {
return $share->setId(42);
- }));
+ });
// Pre share
$this->eventDispatcher->expects($this->at(0))
@@ -1882,9 +1882,9 @@ public function testCreateShareMail() {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnCallback(function(Share $share) {
+ ->willReturnCallback(function(Share $share) {
return $share->setId(42);
- }));
+ });
// Pre share
$this->eventDispatcher->expects($this->at(0))
@@ -1993,10 +1993,10 @@ public function testCreateShareHookError() {
->with(
$this->equalTo('OCP\Share::preShare'),
$this->isInstanceOf(GenericEvent::class)
- )->will($this->returnCallback(function($name, GenericEvent $e) {
+ )->willReturnCallback(function($name, GenericEvent $e) {
$e->setArgument('error', 'I won\'t let you share!');
$e->stopPropagation();
- })
+ }
);
$manager->createShare($share);
@@ -2062,7 +2062,7 @@ public function testCreateShareOfIncomingFederatedShare() {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -2145,22 +2145,22 @@ public function testGetSharesByExpiredLinkShares() {
*/
$this->defaultProvider
->method('getSharesBy')
- ->will($this->returnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
+ ->willReturnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
return array_slice($shares2, $offset, $limit);
- }));
+ });
/*
* Simulate the deleteShare call.
*/
$manager->method('deleteShare')
- ->will($this->returnCallback(function($share) use (&$shares2) {
+ ->willReturnCallback(function($share) use (&$shares2) {
for($i = 0; $i < count($shares2); $i++) {
if ($shares2[$i]->getId() === $share->getId()) {
array_splice($shares2, $i, 1);
break;
}
}
- }));
+ });
$res = $manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_LINK, $node, true, 3, 0);
@@ -2255,13 +2255,13 @@ public function testGetShareByTokenRoom() {
$factory->expects($this->any())
->method('getProviderForType')
- ->will($this->returnCallback(function($shareType) use ($roomShareProvider) {
+ ->willReturnCallback(function($shareType) use ($roomShareProvider) {
if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) {
throw new Exception\ProviderException();
}
return $roomShareProvider;
- }));
+ });
$roomShareProvider->expects($this->once())
->method('getShareByToken')
@@ -2409,9 +2409,9 @@ public function testGetShareByTokenPublicUploadDisabled() {
$this->config
->expects($this->at(1))
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_public_upload', 'yes', 'no'],
- ]));
+ ]);
$this->defaultProvider->expects($this->once())
->method('getShareByToken')
@@ -2464,11 +2464,11 @@ public function testCheckPasswordUpdateShare() {
->setPassword('passwordHash');
$this->hasher->method('verify')->with('password', 'passwordHash', '')
- ->will($this->returnCallback(function($pass, $hash, &$newHash) {
+ ->willReturnCallback(function($pass, $hash, &$newHash) {
$newHash = 'newHash';
return true;
- }));
+ });
$this->defaultProvider->expects($this->once())
->method('update')
@@ -2607,7 +2607,7 @@ public function testUpdateShareUser() {
\OCP\Util::connectHook('OCP\Share', 'post_set_expiration_date', $hookListner, 'post');
$hookListner->expects($this->never())->method('post');
- $this->rootFolder->method('getUserFolder')->with('newUser')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('newUser')->willReturnSelf();
$this->rootFolder->method('getRelativePath')->with('/newUser/files/myPath')->willReturn('/myPath');
$hookListner2 = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
@@ -3294,7 +3294,7 @@ public function testMoveShareUser() {
$share->setSharedWith('recipient');
- $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
+ $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0);
$this->manager->moveShare($share, 'recipient');
$this->addToAssertionCount(1);
@@ -3352,7 +3352,7 @@ public function testMoveShareGroup() {
$this->groupManager->method('get')->with('group')->willReturn($group);
$this->userManager->method('get')->with('recipient')->willReturn($recipient);
- $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
+ $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0);
$this->manager->moveShare($share, 'recipient');
$this->addToAssertionCount(1);
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index a5a54fce09f68..2e9687b0ad3a3 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -439,13 +439,13 @@ public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $ex
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('test'));
+ ->willReturn('test');
$tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable);
$this->groupManager->expects($this->any())
->method('isAdmin')
->with('test')
- ->will($this->returnValue($isAdmin));
+ ->willReturn($isAdmin);
$this->assertEquals($expectedResult, $this->tagManager->canUserSeeTag($tag1, $user));
}
@@ -486,18 +486,18 @@ public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin,
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('test'));
+ ->willReturn('test');
$tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable);
$this->tagManager->setTagGroups($tag1, $tagGroupIds);
$this->groupManager->expects($this->any())
->method('isAdmin')
->with('test')
- ->will($this->returnValue($isAdmin));
+ ->willReturn($isAdmin);
$this->groupManager->expects($this->any())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue($userGroupIds));
+ ->willReturn($userGroupIds);
$this->assertEquals($expectedResult, $this->tagManager->canUserAssignTag($tag1, $user));
}
diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
index f0e535b0f6714..986686dc93e3c 100644
--- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php
+++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
@@ -88,7 +88,7 @@ protected function setUp(): void {
$this->tagManager->expects($this->any())
->method('getTagsByIds')
- ->will($this->returnCallback(function($tagIds) {
+ ->willReturnCallback(function($tagIds) {
$result = [];
if (in_array(1, $tagIds)) {
$result[1] = $this->tag1;
@@ -100,7 +100,7 @@ protected function setUp(): void {
$result[3] = $this->tag3;
}
return $result;
- }));
+ });
$this->tagMapper->assignTags('1', 'testtype', $this->tag1->getId());
$this->tagMapper->assignTags('1', 'testtype', $this->tag2->getId());
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index db0a77f68f041..08d8ffb79213f 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -57,7 +57,7 @@ protected function setUp(): void {
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->objectType = $this->getUniqueID('type_');
$this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
@@ -78,7 +78,7 @@ public function testTagManagerWithoutUserReturnsNull() {
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
$this->assertNull($this->tagMgr->load($this->objectType));
}
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index b12124ea5a918..7a2ced517254b 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -121,7 +121,7 @@ public function testProcessUncachedFileNoAppDataFolder() {
$fileDeps = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -130,7 +130,7 @@ public function testProcessUncachedFileNoAppDataFolder() {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -158,7 +158,7 @@ public function testProcessUncachedFile() {
$gzfile = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -167,7 +167,7 @@ public function testProcessUncachedFile() {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -201,7 +201,7 @@ public function testProcessCachedFile() {
->willReturn(true);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $fileDeps) {
+ ->willReturnCallback(function($path) use ($file, $fileDeps) {
if ($path === 'combine.js') {
return $file;
}
@@ -211,7 +211,7 @@ public function testProcessCachedFile() {
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -246,12 +246,12 @@ public function testProcessCachedFileMemcache() {
->willReturn('{}');
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -263,7 +263,7 @@ public function testIsCachedNoDepsFile() {
$file = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
@@ -271,7 +271,7 @@ public function testIsCachedNoDepsFile() {
throw new NotFoundException();
}
$this->fail();
- }));
+ });
$actual = self::invokePrivate($this->jsCombiner, 'isCached', [$fileName, $folder]);
$this->assertFalse($actual);
@@ -345,7 +345,7 @@ public function testCacheNoFile() {
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(
+ $folder->method('newFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -356,7 +356,7 @@ function ($filename) use ($file, $depsFile, $gzFile) {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -376,7 +376,7 @@ public function testCache() {
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -387,7 +387,7 @@ function ($filename) use ($file, $depsFile, $gzFile) {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -444,7 +444,7 @@ public function testCacheSuccess() {
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -455,7 +455,7 @@ function ($filename) use ($file, $depsFile, $gzFile) {
}
$this->fail();
}
- ));
+ );
$file->expects($this->at(0))
->method('putContent')
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index 6f9fdf1e7fbd0..9e8c30961fb5a 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -121,7 +121,7 @@ public function testProcessUncachedFileNoAppDataFolder() {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -131,7 +131,7 @@ public function testProcessUncachedFileNoAppDataFolder() {
} else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -161,7 +161,7 @@ public function testProcessUncachedFile() {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -171,7 +171,7 @@ public function testProcessUncachedFile() {
}else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -197,7 +197,7 @@ public function testProcessCachedFile() {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -206,7 +206,7 @@ public function testProcessCachedFile() {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -235,7 +235,7 @@ public function testProcessCachedFileMemcache() {
$filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -244,7 +244,7 @@ public function testProcessCachedFileMemcache() {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -273,7 +273,7 @@ public function testIsCachedNoDepsFile() {
$file->expects($this->once())->method('getSize')->willReturn(1);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'styles.css') {
return $file;
} else if ($path === 'styles.css.deps') {
@@ -281,7 +281,7 @@ public function testIsCachedNoDepsFile() {
} else {
$this->fail();
}
- }));
+ });
$this->appData->expects($this->any())
->method('getFolder')
@@ -301,7 +301,7 @@ public function testCacheNoFile() {
$path = \OC::$SERVERROOT . '/core/css/';
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('newFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -310,7 +310,7 @@ public function testCacheNoFile() {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -335,7 +335,7 @@ public function testCache() {
$webDir = "core/css";
$path = \OC::$SERVERROOT;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -344,7 +344,7 @@ public function testCache() {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -369,7 +369,7 @@ public function testCacheSuccess() {
$webDir = "tests/data/scss";
$path = \OC::$SERVERROOT . $webDir;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles-success.css') {
return $file;
} else if ($fileName === 'styles-success.css.deps') {
@@ -378,7 +378,7 @@ public function testCacheSuccess() {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->at(0))
->method('setIconsCss')
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index b80e720efd3eb..b76105e9346d5 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -479,9 +479,9 @@ protected function assertTemplate($expectedHtml, $template, $vars = []) {
$l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$t = new Base($template, $requestToken, $l10n, $theme);
$buf = $t->fetchPage($vars);
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index b25557d55690e..2f139319bbf1a 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -74,12 +74,12 @@ public function testCheckInCache() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(time()));
+ ->willReturn(time());
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('core', 'lastupdateResult')
- ->will($this->returnValue(json_encode($expectedResult)));
+ ->willReturn(json_encode($expectedResult));
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -104,7 +104,7 @@ public function testCheckWithoutUpdateUrl() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -118,12 +118,12 @@ public function testCheckWithoutUpdateUrl() {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -142,7 +142,7 @@ public function testCheckWithoutUpdateUrl() {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -157,7 +157,7 @@ public function testCheckWithInvalidXml() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -171,12 +171,12 @@ public function testCheckWithInvalidXml() {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -187,7 +187,7 @@ public function testCheckWithInvalidXml() {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame([], $this->updater->check());
}
@@ -212,7 +212,7 @@ public function testCheckWithEmptyValidXmlResponse() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -226,12 +226,12 @@ public function testCheckWithEmptyValidXmlResponse() {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$updateXml = '
@@ -245,7 +245,7 @@ public function testCheckWithEmptyValidXmlResponse() {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -262,7 +262,7 @@ public function testCheckWithEmptyInvalidXmlResponse() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -276,12 +276,12 @@ public function testCheckWithEmptyInvalidXmlResponse() {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -292,7 +292,7 @@ public function testCheckWithEmptyInvalidXmlResponse() {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -317,7 +317,7 @@ public function testCheckWithMissingAttributeXmlResponse() {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -331,12 +331,12 @@ public function testCheckWithMissingAttributeXmlResponse() {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
// missing autoupdater element should still not fail
$updateXml = '
@@ -350,7 +350,7 @@ public function testCheckWithMissingAttributeXmlResponse() {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 40197101fd6e7..1dc0182a960b6 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -60,7 +60,7 @@ public function testUserExistsSingleBackendExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -76,7 +76,7 @@ public function testUserExistsSingleBackendNotExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -98,7 +98,7 @@ public function testUserExistsTwoBackendsSecondExists() {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -107,7 +107,7 @@ public function testUserExistsTwoBackendsSecondExists() {
$backend2->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -124,7 +124,7 @@ public function testUserExistsTwoBackendsFirstExists() {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -148,17 +148,17 @@ public function testCheckPassword() {
$backend->expects($this->once())
->method('checkPassword')
->with($this->equalTo('foo'), $this->equalTo('bar'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\USER\BACKEND::CHECK_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -177,7 +177,7 @@ public function testCheckPasswordNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -193,7 +193,7 @@ public function testGetOneBackendExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -211,7 +211,7 @@ public function testGetOneBackendNotExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -227,7 +227,7 @@ public function testGetOneBackendDoNotTranslateLoginNames() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('bLeNdEr'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -245,7 +245,7 @@ public function testSearchOneBackend() {
$backend->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'))
- ->will($this->returnValue(array('foo', 'afoo', 'Afoo1', 'Bfoo')));
+ ->willReturn(array('foo', 'afoo', 'Afoo1', 'Bfoo'));
$backend->expects($this->never())
->method('loginName2UserName');
@@ -268,7 +268,7 @@ public function testSearchTwoBackendLimitOffset() {
$backend1->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
- ->will($this->returnValue(array('foo1', 'foo2')));
+ ->willReturn(array('foo1', 'foo2'));
$backend1->expects($this->never())
->method('loginName2UserName');
@@ -279,7 +279,7 @@ public function testSearchTwoBackendLimitOffset() {
$backend2->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
- ->will($this->returnValue(array('foo3')));
+ ->willReturn(array('foo3'));
$backend2->expects($this->never())
->method('loginName2UserName');
@@ -351,7 +351,7 @@ public function testCreateUserSingleBackendNotExists() {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('createUser')
@@ -360,7 +360,7 @@ public function testCreateUserSingleBackendNotExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -381,7 +381,7 @@ public function testCreateUserSingleBackendExists() {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('createUser');
@@ -389,7 +389,7 @@ public function testCreateUserSingleBackendExists() {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -404,7 +404,7 @@ public function testCreateUserSingleBackendNotSupported() {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->never())
->method('createUser');
@@ -453,7 +453,7 @@ public function testCreateUserTwoBackendExists() {
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->never())
->method('createUser');
@@ -461,7 +461,7 @@ public function testCreateUserTwoBackendExists() {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -469,7 +469,7 @@ public function testCreateUserTwoBackendExists() {
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->never())
->method('createUser');
@@ -477,7 +477,7 @@ public function testCreateUserTwoBackendExists() {
$backend2->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -501,16 +501,16 @@ public function testCountUsersOneBackend() {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(7));
+ ->willReturn(7);
$backend->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -530,28 +530,28 @@ public function testCountUsersTwoBackends() {
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(7));
+ ->willReturn(7);
$backend1->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(16));
+ ->willReturn(16);
$backend2->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -672,21 +672,21 @@ public function testGetByEmail() {
->expects($this->at(0))
->method('getUsersForUserValueCaseInsensitive')
->with('settings', 'email', 'test@example.com')
- ->will($this->returnValue(['uid1', 'uid99', 'uid2']));
+ ->willReturn(['uid1', 'uid99', 'uid2']);
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->at(0))
->method('userExists')
->with($this->equalTo('uid1'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->at(1))
->method('userExists')
->with($this->equalTo('uid99'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->at(2))
->method('userExists')
->with($this->equalTo('uid2'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index e7df7578c7dca..c96a07eb9af2d 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -67,7 +67,7 @@ protected function setUp(): void {
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnValue(10000));
+ ->willReturn(10000);
$this->tokenProvider = $this->createMock(IProvider::class);
$this->config = $this->createMock(IConfig::class);
$this->throttler = $this->createMock(Throttler::class);
@@ -105,12 +105,12 @@ public function testGetUser() {
$expectedUser = $this->createMock(IUser::class);
$expectedUser->expects($this->any())
->method('getUID')
- ->will($this->returnValue('user123'));
+ ->willReturn('user123');
$session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
$session->expects($this->at(0))
->method('get')
->with('user_id')
- ->will($this->returnValue($expectedUser->getUID()));
+ ->willReturn($expectedUser->getUID());
$sessionId = 'abcdef12345';
$manager = $this->getMockBuilder('\OC\User\Manager')
@@ -119,25 +119,25 @@ public function testGetUser() {
$session->expects($this->at(1))
->method('get')
->with('app_password')
- ->will($this->returnValue(null)); // No password set -> browser session
+ ->willReturn(null); // No password set -> browser session
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$this->tokenProvider->expects($this->once())
->method('getPassword')
->with($token, $sessionId)
- ->will($this->returnValue('passme'));
+ ->willReturn('passme');
$manager->expects($this->once())
->method('checkPassword')
->with('User123', 'passme')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expectedUser->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tokenProvider->expects($this->once())
->method('updateTokenActivity')
@@ -146,7 +146,7 @@ public function testGetUser() {
$manager->expects($this->once())
->method('get')
->with($expectedUser->getUID())
- ->will($this->returnValue($expectedUser));
+ ->willReturn($expectedUser);
$userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$user = $userSession->getUser();
@@ -178,7 +178,7 @@ public function testIsLoggedIn($isLoggedIn) {
$user = new User('sepp', null, $this->createMock(EventDispatcherInterface::class));
$userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($isLoggedIn ? $user : null));
+ ->willReturn($isLoggedIn ? $user : null);
$this->assertEquals($isLoggedIn, $userSession->isLoggedIn());
}
@@ -195,7 +195,7 @@ public function testSetUser() {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$userSession->setUser($user);
@@ -240,17 +240,17 @@ public function testLoginValidPasswordEnabled() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$user->expects($this->once())
->method('updateLastLoginTimestamp');
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher])
@@ -304,14 +304,14 @@ public function testLoginValidPasswordDisabled() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user->expects($this->never())
->method('updateLastLoginTimestamp');
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->dispatcher->expects($this->never())
->method('dispatch');
@@ -355,7 +355,7 @@ public function testLoginInvalidPassword() {
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->dispatcher->expects($this->never())
->method('dispatch');
@@ -380,7 +380,7 @@ public function testLoginNonExisting() {
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->login('foo', 'bar');
}
@@ -404,12 +404,12 @@ public function testLoginWithDifferentTokenLoginName() {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->login('foo', 'bar');
}
@@ -435,7 +435,7 @@ public function testLogClientInNoTokenPasswordWith2fa() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$request
->expects($this->any())
->method('getRemoteAddress')
@@ -471,7 +471,7 @@ public function testLogClientInUnexist() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager->method('getByEmail')
->with('unexist')
->willReturn([]);
@@ -492,11 +492,11 @@ public function testLogClientInWithTokenPassword() {
$userSession->expects($this->once())
->method('isTokenPassword')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$userSession->expects($this->once())
->method('login')
->with('john', 'I-AM-AN-APP-PASSWORD')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$session->expects($this->once())
->method('set')
@@ -539,12 +539,12 @@ public function testLogClientInNoTokenPasswordNo2fa() {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->expects($this->once())
->method('isTwoFactorEnforced')
->with('john')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$request
->expects($this->any())
@@ -592,18 +592,18 @@ public function testRememberLoginValidToken() {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue([$token]));
+ ->willReturn([$token]);
$this->config->expects($this->once())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
$this->random->expects($this->once())
->method('generate')
->with(32)
- ->will($this->returnValue('abcdefg123456'));
+ ->willReturn('abcdefg123456');
$this->config->expects($this->once())
->method('setUserValue')
->with('foo', 'login_token', 'abcdefg123456', 10000);
@@ -617,7 +617,7 @@ public function testRememberLoginValidToken() {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('renewSessionToken')
->with($oldSessionId, $sessionId)
@@ -628,7 +628,7 @@ public function testRememberLoginValidToken() {
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession->expects($this->once())
->method('setMagicInCookie');
$user->expects($this->once())
@@ -636,11 +636,11 @@ public function testRememberLoginValidToken() {
$setUID = false;
$session
->method('set')
- ->will($this->returnCallback(function ($k, $v) use (&$setUID) {
+ ->willReturnCallback(function ($k, $v) use (&$setUID) {
if ($k === 'user_id' && $v === 'foo') {
$setUID = true;
}
- }));
+ });
$userSession->expects($this->once())
->method('setLoginName')
->willReturn('foobar');
@@ -681,11 +681,11 @@ public function testRememberLoginInvalidSessionToken() {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue([$token]));
+ ->willReturn([$token]);
$this->config->expects($this->once())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
@@ -694,7 +694,7 @@ public function testRememberLoginInvalidSessionToken() {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('renewSessionToken')
->with($oldSessionId, $sessionId)
@@ -702,7 +702,7 @@ public function testRememberLoginInvalidSessionToken() {
$user->expects($this->never())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession->expects($this->never())
->method('setMagicInCookie');
$user->expects($this->never())
@@ -744,11 +744,11 @@ public function testRememberLoginInvalidToken() {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue(['anothertoken']));
+ ->willReturn(['anothertoken']);
$this->config->expects($this->never())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
@@ -794,11 +794,11 @@ public function testRememberLoginInvalidUser() {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->config->expects($this->never())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue(['anothertoken']));
+ ->willReturn(['anothertoken']);
$this->tokenProvider->expects($this->never())
->method('renewSessionToken');
@@ -825,9 +825,9 @@ public function testActiveUserAfterSetSession() {
$manager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function ($uid) use ($users) {
+ ->willReturnCallback(function ($uid) use ($users) {
return $users[$uid];
- }));
+ });
$session = new Memory('');
$session->set('user_id', 'foo');
@@ -873,10 +873,10 @@ public function testCreateSessionToken() {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
@@ -914,10 +914,10 @@ public function testCreateRememberedSessionToken() {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
@@ -959,18 +959,18 @@ public function testCreateSessionTokenWithTokenPassword() {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$this->tokenProvider->expects($this->once())
->method('getPassword')
->with($token, $password)
- ->will($this->returnValue($realPassword));
+ ->willReturn($realPassword);
$this->tokenProvider->expects($this->once())
->method('generateToken')
@@ -994,7 +994,7 @@ public function testCreateSessionTokenWithNonExistentUser() {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password));
}
@@ -1021,18 +1021,18 @@ public function testTryTokenLoginWithDisabledUser() {
$request->expects($this->once())
->method('getHeader')
->with('Authorization')
- ->will($this->returnValue('Bearer xxxxx'));
+ ->willReturn('Bearer xxxxx');
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('xxxxx')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$manager->expects($this->once())
->method('get')
->with('fritz0')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->tryTokenLogin($request);
}
@@ -1055,23 +1055,23 @@ public function testValidateSessionDisabledUser() {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
- ->will($this->returnValue('123456'));
+ ->willReturn('123456');
$userManager->expects($this->never())
->method('checkPassword');
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$tokenProvider->expects($this->once())
->method('invalidateToken')
->with('APP-PASSWORD');
@@ -1099,14 +1099,14 @@ public function testValidateSessionNoPassword() {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
@@ -1135,25 +1135,25 @@ public function testValidateSessionInvalidPassword() {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
- ->will($this->returnValue('123456'));
+ ->willReturn('123456');
$userManager->expects($this->once())
->method('checkPassword')
->with('susan', '123456')
->willReturn(false);
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tokenProvider->expects($this->never())
->method('invalidateToken');
$tokenProvider->expects($this->once())
@@ -1179,11 +1179,11 @@ public function testUpdateSessionTokenPassword() {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$tokenProvider->expects($this->once())
->method('setPassword')
->with($token, $sessionId, $password);
@@ -1218,11 +1218,11 @@ public function testUpdateSessionTokenPasswordInvalidTokenException() {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$tokenProvider->expects($this->once())
->method('setPassword')
->with($token, $sessionId, $password)
@@ -1254,7 +1254,7 @@ public function testUpdateAuthTokenLastCheck() {
$mapper->expects($this->any())
->method('getToken')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$mapper->expects($this->once())
->method('update');
$request
@@ -1273,7 +1273,7 @@ public function testUpdateAuthTokenLastCheck() {
$this->timeFactory
->expects($this->any())
->method('getTime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$manager->method('getByEmail')
->with('john')
@@ -1308,7 +1308,7 @@ public function testNoUpdateAuthTokenLastCheckRecent() {
$mapper->expects($this->any())
->method('getToken')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$mapper->expects($this->never())
->method('update');
$request
@@ -1327,7 +1327,7 @@ public function testNoUpdateAuthTokenLastCheckRecent() {
$this->timeFactory
->expects($this->any())
->method('getTime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$manager->method('getByEmail')
->with('john')
@@ -1375,7 +1375,7 @@ public function testTryBasicAuthLoginValid() {
$this->session
->method('set')
- ->will($this->returnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) {
+ ->willReturnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) {
switch ($k) {
case Auth::DAV_AUTHENTICATED:
$davAuthenticatedSet = $v;
@@ -1386,7 +1386,7 @@ public function testTryBasicAuthLoginValid() {
default:
throw new \Exception();
}
- }));
+ });
$userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index 8431f14f8a280..4e527addc6e0e 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -47,12 +47,12 @@ public function testDisplayName() {
$backend->expects($this->once())
->method('getDisplayName')
->with($this->equalTo('foo'))
- ->will($this->returnValue('Foo'));
+ ->willReturn('Foo');
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('Foo', $user->getDisplayName());
@@ -69,12 +69,12 @@ public function testDisplayNameEmpty() {
$backend->expects($this->once())
->method('getDisplayName')
->with($this->equalTo('foo'))
- ->will($this->returnValue(' '));
+ ->willReturn(' ');
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('foo', $user->getDisplayName());
@@ -91,7 +91,7 @@ public function testDisplayNameNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('foo', $user->getDisplayName());
@@ -108,13 +108,13 @@ public function testSetPassword() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->setPassword('bar',''));
@@ -130,7 +130,7 @@ public function testSetPasswordNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->setPassword('bar',''));
@@ -144,17 +144,17 @@ public function testChangeAvatarSupportedYes() {
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::PROVIDE_AVATAR) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangeAvatar());
@@ -168,17 +168,17 @@ public function testChangeAvatarSupportedNo() {
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::PROVIDE_AVATAR) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangeAvatar());
@@ -221,13 +221,13 @@ public function testDeleteWithDifferentHome() {
$backend->expects($this->at(0))
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::GET_HOME) {
return true;
} else {
return false;
}
- }));
+ });
// important: getHome MUST be called before deleteUser because
// once the user is deleted, getHome implementations might not
@@ -235,7 +235,7 @@ public function testDeleteWithDifferentHome() {
$backend->expects($this->at(1))
->method('getHome')
->with($this->equalTo('foo'))
- ->will($this->returnValue('/home/foo'));
+ ->willReturn('/home/foo');
$backend->expects($this->at(2))
->method('deleteUser')
@@ -253,17 +253,17 @@ public function testGetHome() {
$backend->expects($this->once())
->method('getHome')
->with($this->equalTo('foo'))
- ->will($this->returnValue('/home/foo'));
+ ->willReturn('/home/foo');
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::GET_HOME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('/home/foo', $user->getHome());
@@ -286,18 +286,18 @@ public function testGetHomeNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$allConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$allConfig->expects($this->any())
->method('getUserValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$allConfig->expects($this->any())
->method('getSystemValue')
->with($this->equalTo('datadirectory'))
- ->will($this->returnValue('arbitrary/path'));
+ ->willReturn('arbitrary/path');
$user = new User('foo', $backend, $this->dispatcher, null, $allConfig);
$this->assertEquals('arbitrary/path/foo', $user->getHome());
@@ -311,13 +311,13 @@ public function testCanChangePassword() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangePassword());
@@ -331,7 +331,7 @@ public function testCanChangePasswordNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangePassword());
@@ -345,13 +345,13 @@ public function testCanChangeDisplayName() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangeDisplayName());
@@ -365,7 +365,7 @@ public function testCanChangeDisplayNameNotSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangeDisplayName());
@@ -379,13 +379,13 @@ public function testSetDisplayNameSupported() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$backend->expects($this->once())
->method('setDisplayName')
@@ -408,13 +408,13 @@ public function testSetDisplayNameEmpty() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->setDisplayName(' '));
@@ -466,13 +466,13 @@ public function testSetPasswordHooks() {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, $emitter);
@@ -751,13 +751,13 @@ public function testGetLastLogin() {
$config = $this->createMock(IConfig::class);
$config->method('getUserValue')
- ->will($this->returnCallback(function ($uid, $app, $key, $default) {
+ ->willReturnCallback(function ($uid, $app, $key, $default) {
if ($uid === 'foo' && $app === 'login' && $key === 'lastLogin') {
return 42;
} else {
return $default;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, null, $config);
$this->assertSame(42, $user->getLastLogin());
@@ -861,13 +861,13 @@ public function testGetEMailAddress() {
$config = $this->createMock(IConfig::class);
$config->method('getUserValue')
- ->will($this->returnCallback(function ($uid, $app, $key, $default) {
+ ->willReturnCallback(function ($uid, $app, $key, $default) {
if ($uid === 'foo' && $app === 'settings' && $key === 'email') {
return 'foo@bar.com';
} else {
return $default;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, null, $config);
$this->assertSame('foo@bar.com', $user->getEMailAddress());
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index 3f956601ce45d..9cba59beb475b 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -30,9 +30,9 @@ protected function getConfig($systemOptions) {
$config->expects($this->any())
->method('getValue')
- ->will($this->returnCallback(function ($key, $default) use ($systemOptions) {
+ ->willReturnCallback(function ($key, $default) use ($systemOptions) {
return isset($systemOptions[$key]) ? $systemOptions[$key] : $default;
- }));
+ });
return $config;
}
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index a5ddd50ab2790..94ac17ce345b8 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -187,18 +187,18 @@ function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $ex
->expects($this->at(0))
->method('getAppValue')
->with('core', 'shareapi_exclude_groups', 'no')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$config
->expects($this->at(1))
->method('getAppValue')
->with('core', 'shareapi_exclude_groups_list')
- ->will($this->returnValue(json_encode($excludedGroups)));
+ ->willReturn(json_encode($excludedGroups));
$groupManager
->expects($this->at(0))
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue($membership));
+ ->willReturn($membership);
$result = \OC_Util::isSharingDisabledForUser($config, $groupManager, $user);
@@ -233,9 +233,9 @@ function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) {
$appManager = $this->createMock(IAppManager::class);
$appManager->expects($this->any())
->method('isEnabledForUser')
- ->will($this->returnCallback(function($appId) use ($enabledApps){
+ ->willReturnCallback(function($appId) use ($enabledApps){
return in_array($appId, $enabledApps);
- }));
+ });
Dummy_OC_Util::$appManager = $appManager;
// need to set a user id to make sure enabled apps are read from cache