Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2020-03-26 11:25:19 +0300
committerGitHub <noreply@github.com>2020-03-26 11:25:19 +0300
commit25ab122245da1456701d93d7178f851b660c3cf7 (patch)
tree0365dc30da369f4fe033186302511aab6687a68b /apps
parentb3af054d73801267590e77ae137c56ea0086d6a0 (diff)
parent2ee65f177e4f7e09ad2287f14d564e7068d322fb (diff)
Merge pull request #20172 from nextcloud/techdebt/phpunit-short-return
Use the shorter phpunit syntax for mocked return values
Diffstat (limited to 'apps')
-rw-r--r--apps/comments/tests/Unit/Notification/ListenerTest.php36
-rw-r--r--apps/comments/tests/Unit/Notification/NotifierTest.php4
-rw-r--r--apps/dav/tests/unit/AppInfo/PluginManagerTest.php8
-rw-r--r--apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php20
-rw-r--r--apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php14
-rw-r--r--apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php2
-rw-r--r--apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php10
-rw-r--r--apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php88
-rw-r--r--apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php30
-rw-r--r--apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php22
-rw-r--r--apps/dav/tests/unit/CalDAV/CalDavBackendTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarHomeTest.php6
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarImplTest.php18
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarManagerTest.php12
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php8
-rw-r--r--apps/dav/tests/unit/CalDAV/OutboxTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php16
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php40
-rw-r--r--apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php14
-rw-r--r--apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php12
-rw-r--r--apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php8
-rw-r--r--apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php22
-rw-r--r--apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php20
-rw-r--r--apps/dav/tests/unit/Comments/CommentsNodeTest.php96
-rw-r--r--apps/dav/tests/unit/Comments/CommentsPluginTest.php118
-rw-r--r--apps/dav/tests/unit/Comments/EntityCollectionTest.php12
-rw-r--r--apps/dav/tests/unit/Comments/RootCollectionTest.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/AuthTest.php116
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php6
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php56
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php46
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php36
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php120
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php8
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php20
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php204
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php26
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php34
-rw-r--r--apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php10
-rw-r--r--apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php50
-rw-r--r--apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php14
-rw-r--r--apps/dav/tests/unit/DAV/GroupPrincipalTest.php40
-rw-r--r--apps/dav/tests/unit/DAV/HookManagerTest.php4
-rw-r--r--apps/dav/tests/unit/Files/FileSearchBackendTest.php28
-rw-r--r--apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php8
-rw-r--r--apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php28
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php12
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php22
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php76
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php22
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php46
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php14
-rw-r--r--apps/dav/tests/unit/Upload/ChunkingPluginTest.php12
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php8
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php4
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php4
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php4
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php2
-rw-r--r--apps/encryption/tests/RecoveryTest.php6
-rw-r--r--apps/encryption/tests/SessionTest.php6
-rw-r--r--apps/encryption/tests/UtilTest.php6
-rw-r--r--apps/federatedfilesharing/tests/FederatedShareProviderTest.php4
-rw-r--r--apps/files/tests/BackgroundJob/ScanFilesTest.php24
-rw-r--r--apps/files/tests/Controller/ApiControllerTest.php4
-rw-r--r--apps/files/tests/Controller/ViewControllerTest.php62
-rw-r--r--apps/files/tests/Service/TagServiceTest.php2
-rw-r--r--apps/files_external/tests/Auth/Password/GlobalAuth.php20
-rw-r--r--apps/files_external/tests/Command/ApplicableTest.php4
-rw-r--r--apps/files_external/tests/Command/CommandTest.php4
-rw-r--r--apps/files_external/tests/Controller/StoragesControllerTest.php20
-rw-r--r--apps/files_external/tests/Controller/UserStoragesControllerTest.php2
-rw-r--r--apps/files_external/tests/FrontendDefinitionTraitTest.php4
-rw-r--r--apps/files_external/tests/PersonalMountTest.php2
-rw-r--r--apps/files_external/tests/Service/BackendServiceTest.php18
-rw-r--r--apps/files_external/tests/Service/StoragesServiceTest.php20
-rw-r--r--apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php10
-rw-r--r--apps/files_external/tests/Service/UserStoragesServiceTest.php2
-rw-r--r--apps/files_sharing/tests/ApiTest.php4
-rw-r--r--apps/files_sharing/tests/CapabilitiesTest.php2
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php144
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php12
-rw-r--r--apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php4
-rw-r--r--apps/files_sharing/tests/External/CacheTest.php2
-rw-r--r--apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php2
-rw-r--r--apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php18
-rw-r--r--apps/files_sharing/tests/MountProviderTest.php42
-rw-r--r--apps/files_trashbin/tests/StorageTest.php8
-rw-r--r--apps/files_trashbin/tests/TrashbinTest.php4
-rw-r--r--apps/files_versions/tests/VersioningTest.php8
-rw-r--r--apps/oauth2/tests/Controller/OauthApiControllerTest.php12
-rw-r--r--apps/oauth2/tests/Controller/SettingsControllerTest.php4
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php4
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php718
-rw-r--r--apps/settings/tests/Activity/SecurityFilterTest.php6
-rw-r--r--apps/settings/tests/Activity/SecuritySettingTest.php2
-rw-r--r--apps/settings/tests/Controller/AppSettingsControllerTest.php6
-rw-r--r--apps/settings/tests/Controller/CertificateControllerTest.php26
-rw-r--r--apps/settings/tests/Controller/CheckSetupControllerTest.php120
-rw-r--r--apps/settings/tests/Controller/MailSettingsControllerTest.php8
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php4
-rw-r--r--apps/settings/tests/Mailer/NewUserMailHelperTest.php10
-rw-r--r--apps/settings/tests/Middleware/SubadminMiddlewareTest.php8
-rw-r--r--apps/sharebymail/tests/ShareByMailProviderTest.php4
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php40
-rw-r--r--apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php4
-rw-r--r--apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php2
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php4
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php6
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php12
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php8
-rw-r--r--apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php22
-rw-r--r--apps/user_ldap/tests/AccessTest.php28
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php44
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php116
-rw-r--r--apps/user_ldap/tests/HelperTest.php8
-rw-r--r--apps/user_ldap/tests/Jobs/CleanUpTest.php10
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php18
-rw-r--r--apps/user_ldap/tests/User/UserTest.php168
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php140
-rw-r--r--apps/user_ldap/tests/WizardTest.php120
-rw-r--r--apps/workflowengine/tests/ManagerTest.php4
128 files changed, 1963 insertions, 1963 deletions
diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php
index ee4f296ed0a..1972244a38e 100644
--- a/apps/comments/tests/Unit/Notification/ListenerTest.php
+++ b/apps/comments/tests/Unit/Notification/ListenerTest.php
@@ -78,10 +78,10 @@ class ListenerTest extends TestCase {
$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 @@ class ListenerTest extends TestCase {
->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 @@ class ListenerTest extends TestCase {
['23452-4333-54353-2342'],
['yolo']
)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->listener->evaluate($event);
}
@@ -146,10 +146,10 @@ class ListenerTest extends TestCase {
$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 @@ class ListenerTest extends TestCase {
->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 @@ class ListenerTest extends TestCase {
$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 @@ class ListenerTest extends TestCase {
->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 @@ class ListenerTest extends TestCase {
->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 34de6620897..2924c10c856 100644
--- a/apps/comments/tests/Unit/Notification/NotifierTest.php
+++ b/apps/comments/tests/Unit/Notification/NotifierTest.php
@@ -84,9 +84,9 @@ class NotifierTest extends TestCase {
$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 0d181f914a1..2fbf1271341 100644
--- a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
+++ b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
@@ -84,10 +84,10 @@ class PluginManagerTest extends TestCase {
];
$appManager->method('getAppInfo')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['adavapp', false, null, $appInfo1],
['adavapp2', false, null, $appInfo2],
- ]));
+ ]);
$pluginManager = new PluginManager($server, $appManager);
@@ -96,7 +96,7 @@ class PluginManagerTest extends TestCase {
$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 @@ class PluginManagerTest extends TestCase {
['\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 37bc5195e57..9134186390f 100644
--- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
@@ -59,7 +59,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
$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 @@ class CleanupInvitationTokenJobTest extends TestCase {
$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 b053f9a3996..4529383c37c 100644
--- a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
@@ -54,12 +54,12 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
$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 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
$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 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
$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 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
$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 95aebd449c7..fd0301c7782 100644
--- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
@@ -96,7 +96,7 @@ class RefreshWebcalJobTest extends TestCase {
$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 7251fffc41f..19b3cd64d7d 100644
--- a/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RegisterRegenerateBirthdayCalendarsTest.php
@@ -65,18 +65,18 @@ class RegisterRegenerateBirthdayCalendarsTest extends TestCase {
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 bc515383053..bd232ff852e 100644
--- a/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/UpdateCalendarResourcesRoomsBackgroundJobTest.php
@@ -112,7 +112,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
$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 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
$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 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
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 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
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 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
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 ca58625ec58..f687555a7e4 100644
--- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
@@ -92,11 +92,11 @@ class EnablePluginTest extends TestCase {
$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 @@ class EnablePluginTest extends TestCase {
$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('<nc:disable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>'));
+ ->willReturn('<nc:disable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>');
$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 @@ class EnablePluginTest extends TestCase {
$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('<nc:enable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>'));
+ ->willReturn('<nc:enable-birthday-calendar xmlns:nc="http://nextcloud.com/ns"/>');
$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 f0357f203e2..28921e81ebf 100644
--- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
+++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
@@ -46,9 +46,9 @@ class CachedSubscriptionObjectTest extends \Test\TestCase {
$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 ccf59672669..9cb46767375 100644
--- a/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
+++ b/apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
@@ -158,14 +158,14 @@ class CachedSubscriptionTest extends \Test\TestCase {
$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 @@ class CachedSubscriptionTest extends \Test\TestCase {
$backend->expects($this->at(0))
->method('getCalendarObjects')
->with(666, 1)
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 99,
'uri' => 'foo1'
@@ -196,7 +196,7 @@ class CachedSubscriptionTest extends \Test\TestCase {
'id' => 100,
'uri' => 'foo2'
],
- ]));
+ ]);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -218,7 +218,7 @@ class CachedSubscriptionTest extends \Test\TestCase {
$backend->expects($this->at(0))
->method('getMultipleCalendarObjects')
->with(666, ['foo1', 'foo2'], 1)
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 99,
'uri' => 'foo1'
@@ -227,7 +227,7 @@ class CachedSubscriptionTest extends \Test\TestCase {
'id' => 100,
'uri' => 'foo2'
],
- ]));
+ ]);
$calendar = new CachedSubscription($backend, $calendarInfo);
@@ -266,14 +266,14 @@ class CachedSubscriptionTest extends \Test\TestCase {
$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 @@ class CachedSubscriptionTest extends \Test\TestCase {
$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 8ac4961f19f..257c6665dfe 100644
--- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
@@ -130,9 +130,9 @@ class CalDavBackendTest extends AbstractCalDavBackend {
$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 364286edd4b..d366db8dba6 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
@@ -73,10 +73,10 @@ class CalendarHomeTest extends TestCase {
$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 5a32b5defa5..c32d8128874 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarImplTest.php
@@ -74,7 +74,7 @@ class CalendarImplTest extends \Test\TestCase {
$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 @@ class CalendarImplTest extends \Test\TestCase {
$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 @@ class CalendarImplTest extends \Test\TestCase {
$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 @@ class CalendarImplTest extends \Test\TestCase {
$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 @@ class CalendarImplTest extends \Test\TestCase {
$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 5d5a86524a1..146bfe24fff 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
@@ -60,28 +60,28 @@ class CalendarManagerTest extends \Test\TestCase {
$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 80e75beca5f..9a9f36c9309 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -53,9 +53,9 @@ class CalendarTest extends TestCase {
$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 @@ EOD;
$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 @@ EOD;
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 96bc8ed921d..91e03182be4 100644
--- a/apps/dav/tests/unit/CalDAV/OutboxTest.php
+++ b/apps/dav/tests/unit/CalDAV/OutboxTest.php
@@ -47,7 +47,7 @@ class OutboxTest extends TestCase {
$this->config->expects($this->once())
->method('getAppValue')
->with('dav', 'disableFreeBusy', 'no')
- ->will($this->returnValue('no'));
+ ->willReturn('no');
$this->assertEquals([
[
@@ -82,7 +82,7 @@ class OutboxTest extends TestCase {
$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 2d04c605fcf..dc1e89f34c4 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 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
$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 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
$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 148e7627af6..b07fd70d9f1 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
@@ -285,11 +285,11 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$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 b1da96f4c03..0d48392686a 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
@@ -78,9 +78,9 @@ class IMipPluginTest extends TestCase {
$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 @@ class IMipPluginTest extends TestCase {
$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 @@ class IMipPluginTest extends TestCase {
$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 91782531c17..a5662519a75 100644
--- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
@@ -88,15 +88,15 @@ class SearchPluginTest extends TestCase {
$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 @@ class SearchPluginTest extends TestCase {
]);
$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 @@ class SearchPluginTest extends TestCase {
$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 @@ class SearchPluginTest extends TestCase {
$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 410b233add9..2002bccbd3e 100644
--- a/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/PluginTest.php
@@ -33,12 +33,12 @@ class PluginTest extends \Test\TestCase {
$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 @@ class PluginTest extends \Test\TestCase {
$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 b1d341c2e4e..04f2a3cceab 100644
--- a/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
+++ b/apps/dav/tests/unit/CalDAV/WebcalCaching/RefreshWebcalServiceTest.php
@@ -81,7 +81,7 @@ class RefreshWebcalServiceTest extends TestCase {
$this->caldavBackend->expects($this->once())
->method('getSubscriptionsForUser')
->with('principals/users/testuser')
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => '99',
'uri' => 'sub456',
@@ -100,35 +100,35 @@ class RefreshWebcalServiceTest extends TestCase {
'{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 @@ class RefreshWebcalServiceTest extends TestCase {
$this->caldavBackend->expects($this->once())
->method('getSubscriptionsForUser')
->with('principals/users/testuser')
- ->will($this->returnValue([
+ ->willReturn([
[
'id' => 42,
'uri' => 'sub123',
@@ -186,18 +186,18 @@ class RefreshWebcalServiceTest extends TestCase {
'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 9962cf4ca06..e38bd1810a8 100644
--- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
+++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
@@ -110,7 +110,7 @@ class BirthdayServiceTest extends TestCase {
$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 @@ class BirthdayServiceTest extends TestCase {
$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 @@ class BirthdayServiceTest extends TestCase {
$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 @@ class BirthdayServiceTest extends TestCase {
$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 @@ class BirthdayServiceTest extends TestCase {
$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 @@ class BirthdayServiceTest extends TestCase {
$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 1c0551671f8..9d0e56041d0 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -82,23 +82,23 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 @@ class CommentsNodeTest extends \Test\TestCase {
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 @@ class CommentsNodeTest extends \Test\TestCase {
$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 0ffcf145d81..4929eac3ecc 100644
--- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
@@ -99,17 +99,17 @@ class CommentsPluginTest extends \Test\TestCase {
->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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$request->expects($this->once())
->method('getPath')
- ->will($this->returnValue('/' . $path));
+ ->willReturn('/' . $path);
$request->expects($this->never())
->method('getBodyAsString');
@@ -246,7 +246,7 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
->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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
->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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
->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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
->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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$node->expects($this->once())
->method('findChildren')
->with(5, 10, null)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
@@ -706,11 +706,11 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 @@ class CommentsPluginTest extends \Test\TestCase {
$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 a11d22b956a..50f7a42d222 100644
--- a/apps/dav/tests/unit/Comments/EntityCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
@@ -79,11 +79,11 @@ class EntityCollectionTest extends \Test\TestCase {
$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 @@ class EntityCollectionTest extends \Test\TestCase {
$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 @@ class EntityCollectionTest extends \Test\TestCase {
$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 c228aab9e20..1a7a3fb128e 100644
--- a/apps/dav/tests/unit/Comments/RootCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php
@@ -93,11 +93,11 @@ class RootCollectionTest extends \Test\TestCase {
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 b110066aee1..9fca779d58a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -89,7 +89,7 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
$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 @@ class AuthTest extends TestCase {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession
->expects($this->once())
->method('logClientIn')
@@ -251,7 +251,7 @@ class AuthTest extends TestCase {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request
->expects($this->any())
->method('getMethod')
@@ -260,17 +260,17 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->auth->check($request, $response);
}
@@ -416,17 +416,17 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request
->expects($this->any())
->method('getMethod')
@@ -462,17 +462,17 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
$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 @@ class AuthTest extends TestCase {
$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 @@ class AuthTest extends TestCase {
$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 @@ class AuthTest extends TestCase {
$this->userSession
->expects($this->any())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->expects($this->any())
->method('getUser')
@@ -616,7 +616,7 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 @@ class AuthTest extends TestCase {
->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 d06c70d7ad1..605b365475f 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
@@ -78,13 +78,13 @@ class BlockLegacyClientPluginTest extends TestCase {
->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 @@ class BlockLegacyClientPluginTest extends TestCase {
->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 @@ class BlockLegacyClientPluginTest extends TestCase {
->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 250ccffcd78..9260acd9492 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
@@ -114,11 +114,11 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
->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 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
->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 a78d64f9c94..5cd4e69b7f5 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -81,7 +81,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
->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 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
->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 528327a681a..1bf0b533966 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -89,11 +89,11 @@ class DirectoryTest extends \Test\TestCase {
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 @@ class DirectoryTest extends \Test\TestCase {
$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 @@ class DirectoryTest extends \Test\TestCase {
// 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 @@ class DirectoryTest extends \Test\TestCase {
// 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 @@ class DirectoryTest extends \Test\TestCase {
$this->info->expects($this->once())
->method('isDeletable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$dir = $this->getDir('sub');
$dir->delete();
@@ -166,13 +166,13 @@ class DirectoryTest extends \Test\TestCase {
// 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 @@ class DirectoryTest extends \Test\TestCase {
->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 @@ class DirectoryTest extends \Test\TestCase {
$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 @@ class DirectoryTest extends \Test\TestCase {
$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 @@ class DirectoryTest extends \Test\TestCase {
$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 @@ class DirectoryTest extends \Test\TestCase {
$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 2c9ca1be27f..473c0164d06 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
@@ -168,7 +168,7 @@ class FakeLockerPluginTest extends TestCase {
$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 8842d8be316..96f5a2c385c 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -182,11 +182,11 @@ class FileTest extends TestCase {
->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 @@ class FileTest extends TestCase {
} 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 @@ class FileTest extends TestCase {
->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 @@ class FileTest extends TestCase {
} 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 @@ class FileTest extends TestCase {
$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 @@ class FileTest extends TestCase {
->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 @@ class FileTest extends TestCase {
$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 @@ class FileTest extends TestCase {
$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 @@ class FileTest extends TestCase {
$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 @@ class FileTest extends TestCase {
// 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 @@ class FileTest extends TestCase {
// 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 @@ class FileTest extends TestCase {
->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 35362da177c..d1e863b18ba 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -143,25 +143,25 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$node->expects($this->once())
->method('getSize')
- ->will($this->returnValue(1025));
+ ->willReturn(1025);
$this->plugin->handleGetProperties(
$propFind,
@@ -402,7 +402,7 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$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 @@ class FilesPluginTest extends TestCase {
$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 14dd87ccb98..2614640ba0b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -102,7 +102,7 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
->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 @@ class FilesReportPluginTest extends \Test\TestCase {
->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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 @@ class FilesReportPluginTest extends \Test\TestCase {
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 @@ class FilesReportPluginTest extends \Test\TestCase {
$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 d3488088676..9564ad0cec3 100644
--- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
@@ -56,7 +56,7 @@ class MaintenancePluginTest extends TestCase {
->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 f0991d05992..5d71a705362 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -67,16 +67,16 @@ class NodeTest extends \Test\TestCase {
->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 1ccfa2e479e..76ebbe30189 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -64,7 +64,7 @@ class ObjectTreeTest extends \Test\TestCase {
$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 @@ class ObjectTreeTest extends \Test\TestCase {
$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 @@ class ObjectTreeTest extends \Test\TestCase {
$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 @@ class ObjectTreeTest extends \Test\TestCase {
->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 @@ class ObjectTreeTest extends \Test\TestCase {
->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 @@ class ObjectTreeTest extends \Test\TestCase {
->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 99d8ea72bb0..57613c19f64 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -100,29 +100,29 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->connector->getPrincipalsByPrefix('principals/users');
$this->assertSame([], $response);
@@ -157,12 +157,12 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
->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 @@ class PrincipalTest extends TestCase {
->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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->connector->getGroupMembership('principals/users/foo');
}
@@ -367,22 +367,22 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
}
$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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
$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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
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 @@ class PrincipalTest extends TestCase {
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 56ad3b36f73..50b3ff1c394 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -184,11 +184,11 @@ class QuotaPluginTest extends TestCase {
->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 @@ class QuotaPluginTest extends TestCase {
->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 @@ class QuotaPluginTest extends TestCase {
$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 3aec6b9088a..9771b3f76b4 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 @@ class PartFileInRootUploadTest extends UploadTest {
->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 a71cbb3ab6e..c3566ccc33a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -75,11 +75,11 @@ class SharesPluginTest extends \Test\TestCase {
$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 @@ class SharesPluginTest extends \Test\TestCase {
->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 @@ class SharesPluginTest extends \Test\TestCase {
$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 @@ class SharesPluginTest extends \Test\TestCase {
$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 @@ class SharesPluginTest extends \Test\TestCase {
return [$share];
}
return [];
- }));
+ });
$propFind = new \Sabre\DAV\PropFind(
'/dummyPath',
@@ -173,7 +173,7 @@ class SharesPluginTest extends \Test\TestCase {
->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 @@ class SharesPluginTest extends \Test\TestCase {
$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 @@ class SharesPluginTest extends \Test\TestCase {
$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 @@ class SharesPluginTest extends \Test\TestCase {
}
return [];
- }));
+ });
$this->shareManager->expects($this->any())
->method('getSharesInFolder')
@@ -226,9 +226,9 @@ class SharesPluginTest extends \Test\TestCase {
$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 f417a27329a..c1eaaae42c3 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -85,7 +85,7 @@ class TagsPluginTest extends \Test\TestCase {
$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 @@ class TagsPluginTest extends \Test\TestCase {
->getMock();
$node->expects($this->any())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$expectedCallCount = 0;
if (count($requestedProperties) > 0) {
@@ -109,7 +109,7 @@ class TagsPluginTest extends \Test\TestCase {
$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 @@ class TagsPluginTest extends \Test\TestCase {
->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 @@ class TagsPluginTest extends \Test\TestCase {
->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 @@ class TagsPluginTest extends \Test\TestCase {
->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 @@ class TagsPluginTest extends \Test\TestCase {
->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 @@ class TagsPluginTest extends \Test\TestCase {
->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 e847e3a036e..bfb789678b7 100644
--- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
+++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
@@ -81,18 +81,18 @@ class BirthdayCalendarControllerTest extends TestCase {
$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 811c4cac283..1c29ca7d80b 100644
--- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
+++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
@@ -108,7 +108,7 @@ EOF;
$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 @@ EOF;
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -164,7 +164,7 @@ EOF;
$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 @@ EOF;
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -221,7 +221,7 @@ EOF;
$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 @@ EOF;
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -304,7 +304,7 @@ EOF;
$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 @@ EOF;
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -338,15 +338,15 @@ EOF;
$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 @@ EOF;
$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 @@ EOF;
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
$this->assertEquals($expected, $iTipMessage->message->serialize());
- }));
+ });
@@ -413,47 +413,47 @@ EOF;
$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 45aab9af1f5..28af0715ea1 100644
--- a/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
@@ -59,7 +59,7 @@ class CustomPropertiesBackendTest extends TestCase {
$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 @@ class CustomPropertiesBackendTest extends TestCase {
$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 @@ class CustomPropertiesBackendTest extends TestCase {
$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 @@ class CustomPropertiesBackendTest extends TestCase {
'{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 e60c2619303..08239dfd46a 100644
--- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php
+++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php
@@ -74,7 +74,7 @@ class GroupPrincipalTest extends \Test\TestCase {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([$group1, $group2]));
+ ->willReturn([$group1, $group2]);
$expectedResponse = [
0 => [
@@ -97,7 +97,7 @@ class GroupPrincipalTest extends \Test\TestCase {
->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$response = $this->connector->getPrincipalsByPrefix('principals/groups');
$this->assertSame([], $response);
@@ -109,7 +109,7 @@ class GroupPrincipalTest extends \Test\TestCase {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($group1));
+ ->willReturn($group1);
$expectedResponse = [
'uri' => 'principals/groups/foo',
@@ -126,7 +126,7 @@ class GroupPrincipalTest extends \Test\TestCase {
->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($fooUser));
+ ->willReturn($fooUser);
$expectedResponse = [
'uri' => 'principals/groups/foo',
@@ -142,7 +142,7 @@ class GroupPrincipalTest extends \Test\TestCase {
->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 @@ class GroupPrincipalTest extends \Test\TestCase {
->expects($this->once())
->method('get')
->with('foo/bar')
- ->will($this->returnValue($group1));
+ ->willReturn($group1);
$expectedResponse = [
'uri' => 'principals/groups/foo%2Fbar',
@@ -202,23 +202,23 @@ class GroupPrincipalTest extends \Test\TestCase {
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 @@ class GroupPrincipalTest extends \Test\TestCase {
}
$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 @@ class GroupPrincipalTest extends \Test\TestCase {
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 ab95008585b..7b3388b9e74 100644
--- a/apps/dav/tests/unit/DAV/HookManagerTest.php
+++ b/apps/dav/tests/unit/DAV/HookManagerTest.php
@@ -54,9 +54,9 @@ class HookManagerTest extends TestCase {
$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 2f8dec62480..167b68e076c 100644
--- a/apps/dav/tests/unit/Files/FileSearchBackendTest.php
+++ b/apps/dav/tests/unit/Files/FileSearchBackendTest.php
@@ -133,9 +133,9 @@ class FileSearchBackendTest extends TestCase {
[],
$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 @@ class FileSearchBackendTest extends TestCase {
[],
$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 @@ class FileSearchBackendTest extends TestCase {
[],
$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 @@ class FileSearchBackendTest extends TestCase {
[],
$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 @@ class FileSearchBackendTest extends TestCase {
[],
$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 @@ class FileSearchBackendTest extends TestCase {
$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 @@ class FileSearchBackendTest extends TestCase {
$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 852a22564c3..77646b2c9d1 100644
--- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
+++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
@@ -122,13 +122,13 @@ class FilesDropPluginTest extends TestCase {
->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 @@ class FilesDropPluginTest extends TestCase {
->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 ad56a0dd715..dc6c64f2abb 100644
--- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
+++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
@@ -64,45 +64,45 @@ class RefreshWebcalJobRegistrarTest extends TestCase {
$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 @@ class RefreshWebcalJobRegistrarTest extends TestCase {
'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 @@ class RefreshWebcalJobRegistrarTest extends TestCase {
'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 5dac83c5d96..8e6cd85817b 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -88,11 +88,11 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
$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 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
$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 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
$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 bf3818309fa..b8f45fdae3c 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -118,11 +118,11 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 @@ class SystemTagNodeTest extends \Test\TestCase {
$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 93f9a4f4e22..f634c717093 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -202,20 +202,20 @@ class SystemTagPluginTest extends \Test\TestCase {
->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 @@ class SystemTagPluginTest extends \Test\TestCase {
->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 @@ class SystemTagPluginTest extends \Test\TestCase {
->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 @@ class SystemTagPluginTest extends \Test\TestCase {
->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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 @@ class SystemTagPluginTest extends \Test\TestCase {
$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 c7e3a4a9146..17616227088 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -57,18 +57,18 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
->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 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->with(['123'])
- ->will($this->returnValue([$tag]));
+ ->willReturn([$tag]);
$this->getNode(false)->getChild('123');
}
@@ -158,7 +158,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$this->tagManager->expects($this->once())
->method('getAllTags')
->with(null)
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->assertCount(0, $this->getNode()->getChildren());
}
@@ -212,12 +212,12 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
$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 58de0dd54ab..b28590a5962 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -76,16 +76,16 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$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 7854360e0fd..0a98cfdc4e0 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -66,18 +66,18 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
->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 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$this->userFolder->expects($this->once())
->method('getById')
->with('555')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$this->node->getChild('555');
}
@@ -145,7 +145,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$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 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$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 d0eeed78678..d338c5b31f1 100644
--- a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php
+++ b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php
@@ -80,7 +80,7 @@ class ChunkingPluginTest extends TestCase {
$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 @@ class ChunkingPluginTest extends TestCase {
$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 @@ class ChunkingPluginTest extends TestCase {
$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 @@ class ChunkingPluginTest extends TestCase {
$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 e3614b918c3..c6f7a8649b6 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -108,10 +108,10 @@ class RecoveryControllerTest extends TestCase {
$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 @@ class RecoveryControllerTest extends TestCase {
$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 62c5ebf608c..c2f67478bb7 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -85,9 +85,9 @@ class SettingsControllerTest extends TestCase {
$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 8e217bfa473..f93be963989 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -63,9 +63,9 @@ class StatusControllerTest extends TestCase {
->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 7b563c06c02..9a541880e79 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -151,10 +151,10 @@ class EncryptionTest extends TestCase {
$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 4d35d546317..53548c7ccd8 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -307,7 +307,7 @@ class UserHooksTest extends TestCase {
->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 a76d5f7d562..9dbc818af3a 100644
--- a/apps/encryption/tests/RecoveryTest.php
+++ b/apps/encryption/tests/RecoveryTest.php
@@ -168,7 +168,7 @@ class RecoveryTest extends TestCase {
$this->cryptMock->expects($this->once())
->method('decryptPrivateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld'));
}
@@ -283,11 +283,11 @@ class RecoveryTest extends TestCase {
$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 21de1ee971c..daa05b140da 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -204,15 +204,15 @@ class SessionTest extends TestCase {
$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 cade0b2f823..e9133055f41 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -75,7 +75,7 @@ class UtilTest extends TestCase {
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 @@ class UtilTest extends TestCase {
$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 c8acdd3df53..ecac809d434 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -97,9 +97,9 @@ class FederatedShareProviderTest extends \Test\TestCase {
->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 82f69df3ddc..5686fbc749c 100644
--- a/apps/files/tests/BackgroundJob/ScanFilesTest.php
+++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php
@@ -63,22 +63,22 @@ class ScanFilesTest extends TestCase {
->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 @@ class ScanFilesTest extends TestCase {
->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 @@ class ScanFilesTest extends TestCase {
->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 8b2a763ec52..b35d9d7b95d 100644
--- a/apps/files/tests/Controller/ApiControllerTest.php
+++ b/apps/files/tests/Controller/ApiControllerTest.php
@@ -77,11 +77,11 @@ class ApiControllerTest extends TestCase {
$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 3182172acfa..8f2f8fe9ec1 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -91,10 +91,10 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 @@ class ViewControllerTest extends TestCase {
$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 7366c926b90..bc7c803953b 100644
--- a/apps/files/tests/Service/TagServiceTest.php
+++ b/apps/files/tests/Service/TagServiceTest.php
@@ -85,7 +85,7 @@ class TagServiceTest extends \Test\TestCase {
$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 bcfcaedbac1..88569c9cac9 100644
--- a/apps/files_external/tests/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php
@@ -57,22 +57,22 @@ class GlobalAuthTest extends TestCase {
$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 @@ class GlobalAuthTest extends TestCase {
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 @@ class GlobalAuthTest extends TestCase {
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 3b889ceaa78..49fae6e0013 100644
--- a/apps/files_external/tests/Command/ApplicableTest.php
+++ b/apps/files_external/tests/Command/ApplicableTest.php
@@ -36,11 +36,11 @@ class ApplicableTest extends CommandTest {
$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 39688a2e321..2e7e377c28e 100644
--- a/apps/files_external/tests/Command/CommandTest.php
+++ b/apps/files_external/tests/Command/CommandTest.php
@@ -53,14 +53,14 @@ abstract class CommandTest extends TestCase {
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 7dee96e3412..3ecf47419b5 100644
--- a/apps/files_external/tests/Controller/StoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/StoragesControllerTest.php
@@ -108,10 +108,10 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
- ->will($this->returnValue($authMechValidate));
+ ->willReturn($authMechValidate);
$authMech->method('isVisibleFor')
->willReturn(true);
@@ -372,13 +372,13 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$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 920bb72ab70..7d8f60380c6 100644
--- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
@@ -76,7 +76,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$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 76a8ab326f0..e6a62991f36 100644
--- a/apps/files_external/tests/FrontendDefinitionTraitTest.php
+++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php
@@ -101,10 +101,10 @@ class FrontendDefinitionTraitTest extends \Test\TestCase {
->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 09862257ecb..621894138f4 100644
--- a/apps/files_external/tests/PersonalMountTest.php
+++ b/apps/files_external/tests/PersonalMountTest.php
@@ -40,7 +40,7 @@ class PersonalMountTest extends TestCase {
$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 bb65d9a6de6..2191060444a 100644
--- a/apps/files_external/tests/Service/BackendServiceTest.php
+++ b/apps/files_external/tests/Service/BackendServiceTest.php
@@ -51,8 +51,8 @@ class BackendServiceTest extends \Test\TestCase {
$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 @@ class BackendServiceTest extends \Test\TestCase {
$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 @@ class BackendServiceTest extends \Test\TestCase {
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 @@ class BackendServiceTest extends \Test\TestCase {
$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 a598739b97e..9d3a44042e0 100644
--- a/apps/files_external/tests/Service/StoragesServiceTest.php
+++ b/apps/files_external/tests/Service/StoragesServiceTest.php
@@ -117,20 +117,20 @@ abstract class StoragesServiceTest extends \Test\TestCase {
'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 @@ abstract class StoragesServiceTest extends \Test\TestCase {
$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 @@ abstract class StoragesServiceTest extends \Test\TestCase {
$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 ef8dc8a250e..ebdc2e01d52 100644
--- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php
@@ -71,11 +71,11 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$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 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
}
}
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 62f9f6b9d6c..cc000c28a80 100644
--- a/apps/files_external/tests/Service/UserStoragesServiceTest.php
+++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php
@@ -64,7 +64,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
$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 cbec30f375e..c510c4dad98 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -107,9 +107,9 @@ class ApiTest extends TestCase {
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 880921553f3..a75b474cca9 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -58,7 +58,7 @@ class CapabilitiesTest extends \Test\TestCase {
*/
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 0c2606b360c..69b00ff9424 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -122,9 +122,9 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$this->groupManager
->method('isInGroup')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($user, $group) {
return $group === 'currentUserGroup';
}
- ));
+ );
$result = $ocs->getShares(
$getSharesParameters['sharedWithMe'] ?? 'false',
@@ -1448,11 +1448,11 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
~\OCP\Constants::PERMISSION_DELETE &
~\OCP\Constants::PERMISSION_CREATE,
''
- )->will($this->returnCallback(
+ )->willReturnCallback(
function ($share) {
$share->setSharedWith('recipientRoom');
$share->setPermissions(
@@ -2189,7 +2189,7 @@ class ShareAPIControllerTest extends TestCase {
~\OCP\Constants::PERMISSION_CREATE
);
}
- ));
+ );
$this->serverContainer->method('query')
->with('\OCA\Talk\Share\Helper\ShareAPIController')
@@ -2207,7 +2207,7 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
~\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 @@ class ShareAPIControllerTest extends TestCase {
->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 @@ class ShareAPIControllerTest extends TestCase {
$share->getLabel() === '' &&
$share->getHideDownload() === false;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -2534,7 +2534,7 @@ class ShareAPIControllerTest extends TestCase {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -2588,7 +2588,7 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')
->willReturn([]);
@@ -3100,7 +3100,7 @@ class ShareAPIControllerTest extends TestCase {
$share->getLabel() === 'label' &&
$share->getHideDownload() === true;
})
- )->will($this->returnArgument(0));
+ )->willReturnArgument(0);
$this->shareManager->method('getSharedWith')->willReturn([]);
@@ -3161,7 +3161,7 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
* @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 @@ class ShareAPIControllerTest extends TestCase {
$this->rootFolder->method('getUserFolder')
->with($this->currentUser)
- ->will($this->returnSelf());
+ ->willReturnSelf();
if (!$exception) {
$this->rootFolder->method('getById')
@@ -4103,14 +4103,14 @@ class ShareAPIControllerTest extends TestCase {
$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 @@ class ShareAPIControllerTest extends TestCase {
],
],
],
- ]));
+ ]);
try {
$result = $this->invokePrivate($this->ocs, 'formatShare', [$share]);
@@ -4271,7 +4271,7 @@ class ShareAPIControllerTest extends TestCase {
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 @@ class ShareAPIControllerTest extends TestCase {
$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 fbce22b403f..35807dffe82 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -282,9 +282,9 @@ class ShareControllerTest extends \Test\TestCase {
$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 @@ class ShareControllerTest extends \Test\TestCase {
$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 @@ class ShareControllerTest extends \Test\TestCase {
$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 68c827dd922..7319a1bd429 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -291,13 +291,13 @@ class ShareesAPIControllerTest extends TestCase {
$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 946faae3d08..766f0232b87 100644
--- a/apps/files_sharing/tests/External/CacheTest.php
+++ b/apps/files_sharing/tests/External/CacheTest.php
@@ -69,7 +69,7 @@ class CacheTest extends TestCase {
$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 927cdd8a053..e4d6cefac4f 100644
--- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
@@ -51,7 +51,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
$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 54db20c239e..4a6d3859b03 100644
--- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
+++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php
@@ -83,7 +83,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
->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 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
->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 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
$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 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
->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 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
->expects($this->once())
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$controller = $this->createMock(ShareController::class);
@@ -207,7 +207,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase {
->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 f80b5840bcf..fafed2123f1 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -76,25 +76,25 @@ class MountProviderTest extends \Test\TestCase {
$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 @@ class MountProviderTest extends \Test\TestCase {
$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 @@ class MountProviderTest extends \Test\TestCase {
$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 @@ class MountProviderTest extends \Test\TestCase {
$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 eb4e4635521..6b57d111ea9 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -476,13 +476,13 @@ class StorageTest extends \Test\TestCase {
$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 @@ class StorageTest extends \Test\TestCase {
$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 e682d0dd51f..4465bfbab3c 100644
--- a/apps/files_trashbin/tests/TrashbinTest.php
+++ b/apps/files_trashbin/tests/TrashbinTest.php
@@ -122,13 +122,13 @@ class TrashbinTest extends \Test\TestCase {
$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 e07a1816c30..53179bd6b30 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -86,13 +86,13 @@ class VersioningTest extends \Test\TestCase {
$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 @@ class VersioningTest extends \Test\TestCase {
$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 4fca0eaa90c..820c8e041ac 100644
--- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php
+++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php
@@ -248,9 +248,9 @@ class OauthApiControllerTest extends TestCase {
->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 @@ class OauthApiControllerTest extends TestCase {
->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 @@ class OauthApiControllerTest extends TestCase {
->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 76a4fb55ae6..1a6f20fcf80 100644
--- a/apps/oauth2/tests/Controller/SettingsControllerTest.php
+++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php
@@ -100,10 +100,10 @@ class SettingsControllerTest extends TestCase {
$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 742f621c6a4..5416e686ee3 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -167,12 +167,12 @@ class GroupsControllerTest extends \Test\TestCase {
$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 ac2da91005e..05c9506d6ec 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -141,20 +141,20 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('userExists')
->with('AlreadyExistingUser')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->logger
->expects($this->once())
->method('error')
@@ -245,11 +245,11 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
['ExistingGroup'],
['NonExistingGroup']
)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['ExistingGroup', true],
['NonExistingGroup', false]
- ]));
+ ]);
$this->api->addUser('NewUser', 'pass', '', '', ['ExistingGroup', 'NonExistingGroup']);
}
@@ -342,7 +342,7 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -357,11 +357,11 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -414,11 +414,11 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->never())
->method('createUser');
@@ -557,11 +557,11 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('userExists')
->with('NewUser')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userManager
->expects($this->once())
->method('createUser')
@@ -666,11 +666,11 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
['ExistingGroup1'],
['ExistingGroup2']
)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['ExistingGroup1', $existingGroup1],
['ExistingGroup2', $existingGroup2]
- ]));
+ ]);
$this->logger
->expects($this->exactly(3))
->method('info')
@@ -868,12 +868,12 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('admin'));
+ ->willReturn('admin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -901,17 +901,17 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$this->groupManager
->expects($this->once())
->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
+ ->willReturn($subAdminManager);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -950,17 +950,17 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$targetUser
->expects($this->exactly(6))
->method('getUID')
- ->will($this->returnValue('UID'));
+ ->willReturn('UID');
$expected = [
'id' => 'UID',
@@ -1024,7 +1024,7 @@ class UsersControllerTest extends TestCase {
$loggedInUser
->expects($this->once())
->method('getUID')
- ->will($this->returnValue('subadmin'));
+ ->willReturn('subadmin');
$targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -1035,17 +1035,17 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -1065,22 +1065,22 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('isUserAccessible')
->with($loggedInUser, $targetUser)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$subAdminManager
->expects($this->once())
->method('getSubAdminsGroups')
@@ -1233,7 +1233,7 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->getUsersGroups('UserToLookup');
}
@@ -2125,26 +2125,26 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->removeFromGroup('TargetUser', '');
}
@@ -2484,7 +2484,7 @@ class UsersControllerTest extends TestCase {
$this->userSession
->expects($this->once())
->method('getUser')
- ->will($this->returnValue($loggedInUser));
+ ->willReturn($loggedInUser);
$this->api->removeFromGroup('TargetUser', '');
}
@@ -2498,12 +2498,12 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->addSubAdmin('NotExistingUser', '');
}
@@ -2809,12 +2809,12 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->removeSubAdmin('NotExistingUser', 'GroupToDeleteFrom');
}
@@ -2932,12 +2932,12 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('get')
->with('RequestedUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->getUserSubAdminGroups('RequestedUser');
}
@@ -3030,23 +3030,23 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('get')
->with('NotExistingUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->api->resendWelcomeMessage('NotExistingUser');
}
@@ -3241,24 +3241,24 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 @@ class UsersControllerTest extends TestCase {
$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 @@ class UsersControllerTest extends TestCase {
->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 fc30132e6de..750e242c889 100644
--- a/apps/settings/tests/Activity/SecurityFilterTest.php
+++ b/apps/settings/tests/Activity/SecurityFilterTest.php
@@ -62,11 +62,11 @@ class SecurityFilterTest extends TestCase {
$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 @@ class SecurityFilterTest extends TestCase {
$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 cdb61871dbc..da53f8b38e9 100644
--- a/apps/settings/tests/Activity/SecuritySettingTest.php
+++ b/apps/settings/tests/Activity/SecuritySettingTest.php
@@ -59,7 +59,7 @@ class SecuritySettingTest extends TestCase {
$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 1e386fbaa40..4e7970027ed 100644
--- a/apps/settings/tests/Controller/AppSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php
@@ -90,7 +90,7 @@ class AppSettingsControllerTest extends TestCase {
$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 @@ class AppSettingsControllerTest extends TestCase {
->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 @@ class AppSettingsControllerTest extends TestCase {
->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 e5a004b485f..a04906a6811 100644
--- a/apps/settings/tests/Controller/CertificateControllerTest.php
+++ b/apps/settings/tests/Controller/CertificateControllerTest.php
@@ -85,7 +85,7 @@ class CertificateControllerTest extends \Test\TestCase {
->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 @@ class CertificateControllerTest extends \Test\TestCase {
$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 @@ class CertificateControllerTest extends \Test\TestCase {
->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 93c78143897..46769434f42 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -116,9 +116,9 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
$this->clientService->expects($this->once())
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertFalse(
@@ -232,12 +232,12 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
$this->clientService->expects($this->exactly(4))
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertTrue(
self::invokePrivate(
@@ -262,7 +262,7 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ class CheckSetupControllerTest extends TestCase {
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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
$this->clientService->expects($this->once())
->method('newClient')
- ->will($this->returnValue($client));
+ ->willReturn($client);
$this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
}
@@ -854,7 +854,7 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
->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 @@ class CheckSetupControllerTest extends TestCase {
$this->checker
->expects($this->once())
->method('getResults')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$expected = new DataDisplayResponse(
'No errors have been found.',
@@ -969,7 +969,7 @@ class CheckSetupControllerTest extends TestCase {
$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 @@ Array
*/
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 @@ Array
return $useUTF8MB4;
}
return $default;
- }));
+ });
$checkSetupController = new CheckSetupController(
'settings',
@@ -1438,7 +1438,7 @@ Array
*/
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 @@ Array
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 331e6283544..f0996045006 100644
--- a/apps/settings/tests/Controller/MailSettingsControllerTest.php
+++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php
@@ -153,10 +153,10 @@ class MailSettingsControllerTest extends \Test\TestCase {
$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 @@ class MailSettingsControllerTest extends \Test\TestCase {
$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 @@ class MailSettingsControllerTest extends \Test\TestCase {
$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 5c494d12fec..9253c9d7d2e 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -107,9 +107,9 @@ class UsersControllerTest extends \Test\TestCase {
$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 a6371c37a92..35700245c84 100644
--- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php
+++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php
@@ -84,7 +84,7 @@ class NewUserMailHelperTest extends TestCase {
[]
);
$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 @@ class NewUserMailHelperTest extends TestCase {
});
$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 4b48ec74b81..8b40f002c32 100644
--- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
+++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
@@ -72,7 +72,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->subadminMiddleware->beforeController($this->controller, 'foo');
}
@@ -82,7 +82,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->subadminMiddleware->beforeController($this->controller, 'foo');
}
@@ -91,7 +91,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
->expects($this->once())
->method('hasAnnotation')
->with('NoSubadminRequired')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
@@ -100,7 +100,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
->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 07bba57a19c..cc3c4604283 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -113,9 +113,9 @@ class ShareByMailProviderTest extends TestCase {
$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 8c5f111acee..d6f8ff4c6b0 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -153,9 +153,9 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -243,9 +243,9 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -291,9 +291,9 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$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 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($str) {
+ ->willReturnCallback(function($str) {
return $str;
- }));
+ });
$expected = new DataResponse(
[
@@ -643,9 +643,9 @@ class ThemingControllerTest extends TestCase {
$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 136a734aa81..89cd88e05e3 100644
--- a/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php
+++ b/apps/twofactor_backupcodes/tests/Db/BackupCodeMapperTest.php
@@ -84,7 +84,7 @@ class BackupCodeMapperTest extends TestCase {
$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 @@ class BackupCodeMapperTest extends TestCase {
$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 342ab35b0ea..8cd20df85a7 100644
--- a/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
+++ b/apps/twofactor_backupcodes/tests/Service/BackupCodeStorageTest.php
@@ -59,7 +59,7 @@ class BackupCodeStorageTest extends TestCase {
$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 bd0062e826b..141e6d13202 100644
--- a/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/BackgroundJob/CheckBackupCodeTest.php
@@ -68,9 +68,9 @@ class CheckBackupCodeTest extends TestCase {
$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 0f4b12eae5f..95d94e4fc0d 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Controller/SettingsControllerTest.php
@@ -65,15 +65,15 @@ class SettingsControllerTest extends TestCase {
$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 5a5b3a6d29a..2aec2e72d94 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php
@@ -73,26 +73,26 @@ class ActivityPublisherTest extends TestCase {
$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 194e9dc6e05..2ade2046e75 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Provider/BackupCodesProviderTest.php
@@ -74,7 +74,7 @@ class BackupCodesProviderTest extends TestCase {
$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 @@ class BackupCodesProviderTest extends TestCase {
$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 @@ class BackupCodesProviderTest extends TestCase {
$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 @@ class BackupCodesProviderTest extends TestCase {
$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 a2bd743c17c..ab895f4d854 100644
--- a/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php
+++ b/apps/twofactor_backupcodes/tests/Unit/Service/BackupCodeStorageTest.php
@@ -70,11 +70,11 @@ class BackupCodeStorageTest extends TestCase {
$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 @@ class BackupCodeStorageTest extends TestCase {
$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 @@ class BackupCodeStorageTest extends TestCase {
$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 @@ class BackupCodeStorageTest extends TestCase {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$expected = [
'enabled' => true,
@@ -156,7 +156,7 @@ class BackupCodeStorageTest extends TestCase {
$this->mapper->expects($this->once())
->method('getBackupCodes')
->with($user)
- ->will($this->returnValue($codes));
+ ->willReturn($codes);
$expected = [
'enabled' => false,
@@ -178,11 +178,11 @@ class BackupCodeStorageTest extends TestCase {
$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 @@ class BackupCodeStorageTest extends TestCase {
$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 @@ class BackupCodeStorageTest extends TestCase {
$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 012a6831eb4..e8fa47c6ab9 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -187,7 +187,7 @@ class AccessTest extends TestCase {
$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 @@ class AccessTest extends TestCase {
$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 @@ class AccessTest extends TestCase {
$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 @@ class AccessTest extends TestCase {
// 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 @@ class AccessTest extends TestCase {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -329,13 +329,13 @@ class AccessTest extends TestCase {
$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 @@ class AccessTest extends TestCase {
$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 @@ class AccessTest extends TestCase {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -429,12 +429,12 @@ class AccessTest extends TestCase {
$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 26921592405..82e6f85952d 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -57,7 +57,7 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('areLDAPFunctionsAvailable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
}
public function testOriginalAgentUnchangedOnClone() {
@@ -105,19 +105,19 @@ class ConnectionTest extends \Test\TestCase {
$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 @@ class ConnectionTest extends \Test\TestCase {
$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 @@ class ConnectionTest extends \Test\TestCase {
$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 @@ class ConnectionTest extends \Test\TestCase {
$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 @@ class ConnectionTest extends \Test\TestCase {
$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 7ea4cb463d9..5fdc3c5862c 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -70,7 +70,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('getConnection')
- ->will($this->returnValue($connector));
+ ->willReturn($connector);
return $access;
}
@@ -87,12 +87,12 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue($groupDN));
+ ->willReturn($groupDN);
$access->expects($this->any())
->method('readAttribute')
@@ -123,7 +123,7 @@ class Group_LDAPTest extends TestCase {
// 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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$access->expects($this->never())
->method('dn2groupname');
@@ -251,11 +251,11 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -317,16 +317,16 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$access->expects($this->never())
->method('searchGroups');
@@ -372,11 +372,11 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -479,7 +479,7 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->exactly(3))
->method('readAttribute')
@@ -634,11 +634,11 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
return 'member';
}
return 1;
- }));
+ });
$dn = 'cn=userX,dc=foobar';
@@ -712,7 +712,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->exactly(2))
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->never())
->method('readAttribute')
@@ -730,10 +730,10 @@ class Group_LDAPTest extends TestCase {
$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 @@ class Group_LDAPTest extends TestCase {
$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 af4d24739be..a9b889dbc55 100644
--- a/apps/user_ldap/tests/HelperTest.php
+++ b/apps/user_ldap/tests/HelperTest.php
@@ -67,7 +67,7 @@ class HelperTest extends \Test\TestCase {
]);
$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 @@ class HelperTest extends \Test\TestCase {
return '1';
}
return $default;
- }));
+ });
$result = $this->helper->getServerConfigurationPrefixes(true);
@@ -93,7 +93,7 @@ class HelperTest extends \Test\TestCase {
]);
$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 @@ class HelperTest extends \Test\TestCase {
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 2d8ab254257..22065d14b2c 100644
--- a/apps/user_ldap/tests/Jobs/CleanUpTest.php
+++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php
@@ -54,7 +54,7 @@ class CleanUpTest extends \Test\TestCase {
$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 @@ class CleanUpTest extends \Test\TestCase {
$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 @@ class CleanUpTest extends \Test\TestCase {
$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 784719c3b90..ad73d096efd 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -104,7 +104,7 @@ class ManagerTest extends \Test\TestCase {
$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 @@ class ManagerTest extends \Test\TestCase {
$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 @@ class ManagerTest extends \Test\TestCase {
$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 @@ class ManagerTest extends \Test\TestCase {
$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 @@ class ManagerTest extends \Test\TestCase {
$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 36a312172c1..cb9df7037b9 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -118,13 +118,13 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->atLeastOnce())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -212,7 +212,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -239,7 +239,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -258,11 +258,11 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -297,7 +297,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -324,7 +324,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->user->updateQuota($readQuota);
}
@@ -405,7 +405,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -435,7 +435,7 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
->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 @@ class UserTest extends \Test\TestCase {
));
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
$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 @@ class UserTest extends \Test\TestCase {
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 @@ class UserTest extends \Test\TestCase {
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 @@ class UserTest extends \Test\TestCase {
];
}
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 @@ class UserTest extends \Test\TestCase {
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 @@ class UserTest extends \Test\TestCase {
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 @@ class UserTest extends \Test\TestCase {
];
}
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 e4a105b2bd6..f3052b19327 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -107,7 +107,7 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
@@ -138,29 +138,29 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -652,16 +652,16 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -703,20 +703,20 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
}
@@ -841,9 +841,9 @@ class User_LDAPTest extends TestCase {
$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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
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 @@ class User_LDAPTest extends TestCase {
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 5535a28f44c..db23fc1ed40 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -85,15 +85,15 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
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 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -300,24 +300,24 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -339,24 +339,24 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
return 0;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute();
$this->assertSame(false, $result->hasChanges());
@@ -378,36 +378,36 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
$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 @@ class WizardTest extends TestCase {
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 28001a05a92..aa6f4baef89 100644
--- a/apps/workflowengine/tests/ManagerTest.php
+++ b/apps/workflowengine/tests/ManagerTest.php
@@ -79,9 +79,9 @@ class ManagerTest extends TestCase {
/** @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);