aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /apps/dav/tests/unit/Connector/Sabre
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
downloadnextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz
nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre')
-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
17 files changed, 355 insertions, 355 deletions
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())