summaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/Core/Command/Config/System/SetConfigTest.php8
-rw-r--r--tests/Core/Command/Log/FileTest.php16
-rw-r--r--tests/Core/Command/Log/ManageTest.php12
-rw-r--r--tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php16
-rw-r--r--tests/Core/Controller/AvatarControllerTest.php2
-rw-r--r--tests/Core/Controller/ChangePasswordControllerTest.php2
-rw-r--r--tests/Core/Controller/ClientFlowLoginControllerTest.php4
-rw-r--r--tests/Core/Controller/ClientFlowLoginV2ControllerTest.php28
-rw-r--r--tests/Core/Controller/CssControllerTest.php4
-rw-r--r--tests/Core/Controller/JsControllerTest.php4
-rw-r--r--tests/Core/Controller/LoginControllerTest.php24
-rw-r--r--tests/Core/Controller/LostControllerTest.php56
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php64
-rw-r--r--tests/Core/Controller/UserControllerTest.php4
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php40
-rw-r--r--tests/lib/APITest.php2
-rw-r--r--tests/lib/AllConfigTest.php6
-rw-r--r--tests/lib/App/AppManagerTest.php32
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleBase.php4
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php8
-rw-r--r--tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php8
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php22
-rw-r--r--tests/lib/AppFramework/AppTest.php14
-rw-r--r--tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php4
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php2
-rw-r--r--tests/lib/AppFramework/Db/MapperTest.php4
-rw-r--r--tests/lib/AppFramework/Db/MapperTestUtility.php8
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php30
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php104
-rw-r--r--tests/lib/AppFramework/Http/StreamResponseTest.php12
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php6
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php26
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php22
-rw-r--r--tests/lib/AppTest.php8
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php22
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php10
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php20
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php4
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php34
-rw-r--r--tests/lib/BackgroundJob/JobListTest.php2
-rw-r--r--tests/lib/Cache/FileCacheTest.php8
-rw-r--r--tests/lib/Calendar/ManagerTest.php24
-rw-r--r--tests/lib/Calendar/Resource/ManagerTest.php24
-rw-r--r--tests/lib/Calendar/Room/ManagerTest.php24
-rw-r--r--tests/lib/Command/Integrity/SignAppTest.php48
-rw-r--r--tests/lib/Command/Integrity/SignCoreTest.php36
-rw-r--r--tests/lib/Comments/ManagerTest.php10
-rw-r--r--tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php8
-rw-r--r--tests/lib/ContactsManagerTest.php4
-rw-r--r--tests/lib/DB/MDB2SchemaReaderTest.php4
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php8
-rw-r--r--tests/lib/Encryption/UtilTest.php2
-rw-r--r--tests/lib/FileChunkingTest.php4
-rw-r--r--tests/lib/Files/Cache/CacheTest.php2
-rw-r--r--tests/lib/Files/Config/UserMountCacheTest.php16
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php4
-rw-r--r--tests/lib/Files/Node/FileTest.php32
-rw-r--r--tests/lib/Files/Node/FolderTest.php170
-rw-r--r--tests/lib/Files/Node/NodeTest.php116
-rw-r--r--tests/lib/Files/Node/RootTest.php4
-rw-r--r--tests/lib/Files/Storage/Wrapper/QuotaTest.php10
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php4
-rw-r--r--tests/lib/Files/Type/DetectionTest.php8
-rw-r--r--tests/lib/Files/Utils/ScannerTest.php8
-rw-r--r--tests/lib/Files/ViewTest.php56
-rw-r--r--tests/lib/Group/GroupTest.php68
-rw-r--r--tests/lib/Group/ManagerTest.php166
-rw-r--r--tests/lib/Group/MetaDataTest.php8
-rw-r--r--tests/lib/HelperStorageTest.php2
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php188
-rw-r--r--tests/lib/L10N/FactoryTest.php12
-rw-r--r--tests/lib/LegacyHelperTest.php24
-rw-r--r--tests/lib/Lock/DBLockingProviderTest.php4
-rw-r--r--tests/lib/Mail/MailerTest.php24
-rw-r--r--tests/lib/Mail/MessageTest.php12
-rw-r--r--tests/lib/Memcache/CasTraitTest.php16
-rw-r--r--tests/lib/OCS/ProviderTest.php26
-rw-r--r--tests/lib/Preview/GeneratorTest.php16
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php2
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php2
-rw-r--r--tests/lib/RepairStepTest.php2
-rw-r--r--tests/lib/Security/Bruteforce/ThrottlerTest.php4
-rw-r--r--tests/lib/Security/CredentialsManagerTest.php2
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php6
-rw-r--r--tests/lib/Settings/ManagerTest.php4
-rw-r--r--tests/lib/SetupTest.php28
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php174
-rw-r--r--tests/lib/Share20/LegacyHooksTest.php4
-rw-r--r--tests/lib/Share20/ManagerTest.php200
-rw-r--r--tests/lib/SystemTag/SystemTagManagerTest.php10
-rw-r--r--tests/lib/SystemTag/SystemTagObjectMapperTest.php4
-rw-r--r--tests/lib/TagsTest.php4
-rw-r--r--tests/lib/Template/JSCombinerTest.php32
-rw-r--r--tests/lib/Template/SCSSCacherTest.php32
-rw-r--r--tests/lib/TestCase.php4
-rw-r--r--tests/lib/Updater/VersionCheckTest.php44
-rw-r--r--tests/lib/User/ManagerTest.php74
-rw-r--r--tests/lib/User/SessionTest.php160
-rw-r--r--tests/lib/User/UserTest.php78
-rw-r--r--tests/lib/UtilCheckServerTest.php4
-rw-r--r--tests/lib/UtilTest.php10
102 files changed, 1393 insertions, 1393 deletions
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php
index 9b34afed691..1ed7cf2758f 100644
--- a/tests/Core/Command/Config/System/SetConfigTest.php
+++ b/tests/Core/Command/Config/System/SetConfigTest.php
@@ -83,10 +83,10 @@ class SetConfigTest extends TestCase {
->with('name')
->willReturn($configNames);
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['value', $newValue],
['type', 'string'],
- ]));
+ ]);
$this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
@@ -119,11 +119,11 @@ class SetConfigTest extends TestCase {
->with('name')
->willReturn($configNames);
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['value', 'foobar'],
['type', 'string'],
['update-only', true],
- ]));
+ ]);
$this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index 524a193d86f..c1d005e0c56 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -53,9 +53,9 @@ class FileTest extends TestCase {
public function testEnable() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['enable', 'true']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_type', 'file');
@@ -65,9 +65,9 @@ class FileTest extends TestCase {
public function testChangeFile() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['file', '/foo/bar/file.log']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('logfile', '/foo/bar/file.log');
@@ -89,9 +89,9 @@ class FileTest extends TestCase {
*/
public function testChangeRotateSize($optionValue, $configValue) {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['rotate-size', $optionValue]
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_rotate_size', $configValue);
@@ -101,12 +101,12 @@ class FileTest extends TestCase {
public function testGetConfiguration() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['log_type', 'file', 'log_type_value'],
['datadirectory', \OC::$SERVERROOT.'/data', '/data/directory/'],
['logfile', '/data/directory/nextcloud.log', '/var/log/nextcloud.log'],
['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024],
- ]));
+ ]);
$this->consoleOutput->expects($this->at(0))
->method('writeln')
diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php
index d73bc7ed9c2..cae6293abd1 100644
--- a/tests/Core/Command/Log/ManageTest.php
+++ b/tests/Core/Command/Log/ManageTest.php
@@ -53,9 +53,9 @@ class ManageTest extends TestCase {
public function testChangeBackend() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['backend', 'syslog']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('log_type', 'syslog');
@@ -65,9 +65,9 @@ class ManageTest extends TestCase {
public function testChangeLevel() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['level', 'debug']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('loglevel', 0);
@@ -77,9 +77,9 @@ class ManageTest extends TestCase {
public function testChangeTimezone() {
$this->consoleInput->method('getOption')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['timezone', 'UTC']
- ]));
+ ]);
$this->config->expects($this->once())
->method('setSystemValue')
->with('logtimezone', 'UTC');
diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
index 32608796864..d7238921af5 100644
--- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
+++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
@@ -101,16 +101,16 @@ class UpdateDBTest extends TestCase {
]);
$this->loader->expects($this->exactly(2))
->method('exists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', true],
['testing/newmimetype', false],
- ]));
+ ]);
$this->loader->expects($this->exactly(2))
->method('getId')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', 1],
['testing/newmimetype', 2],
- ]));
+ ]);
$this->loader->expects($this->once())
->method('updateFilecache')
@@ -158,14 +158,14 @@ class UpdateDBTest extends TestCase {
]);
$this->loader->expects($this->exactly(1))
->method('exists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', true],
- ]));
+ ]);
$this->loader->expects($this->exactly(1))
->method('getId')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['testing/existingmimetype', 1],
- ]));
+ ]);
$this->loader->expects($this->once())
->method('updateFilecache')
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index 5c66c06a2c5..d2ae9b036b9 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -92,7 +92,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->cache = $this->getMockBuilder('OCP\ICache')
->disableOriginalConstructor()->getMock();
$this->l = $this->getMockBuilder(IL10N::class)->getMock();
- $this->l->method('t')->will($this->returnArgument(0));
+ $this->l->method('t')->willReturnArgument(0);
$this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php
index a55b0bc232e..175628552bc 100644
--- a/tests/Core/Controller/ChangePasswordControllerTest.php
+++ b/tests/Core/Controller/ChangePasswordControllerTest.php
@@ -57,7 +57,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$this->groupManager = $this->createMock(\OC\Group\Manager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->l = $this->createMock(IL10N::class);
- $this->l->method('t')->will($this->returnArgument(0));
+ $this->l->method('t')->willReturnArgument(0);
/** @var IRequest|\PHPUnit_Framework_MockObject_MockObject $request */
$request = $this->createMock(IRequest::class);
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php
index 3932cb9e144..cd90918144d 100644
--- a/tests/Core/Controller/ClientFlowLoginControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php
@@ -83,9 +83,9 @@ class ClientFlowLoginControllerTest 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);
- }));
+ });
$this->defaults = $this->createMock(Defaults::class);
$this->session = $this->createMock(ISession::class);
$this->tokenProvider = $this->createMock(IProvider::class);
diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
index 3c39a402f55..01c60dd7511 100644
--- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
@@ -183,9 +183,9 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGrantPageInvalidStateToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
return null;
- }));
+ });
$result = $this->controller->grantPage('stateToken');
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
@@ -193,7 +193,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGrantPageInvalidLoginToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -201,7 +201,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
return 'loginToken';
}
return null;
- }));
+ });
$this->loginFlowV2Service->method('getByLoginToken')
->with('loginToken')
@@ -213,7 +213,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGrantPageValid() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -221,7 +221,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
return 'loginToken';
}
return null;
- }));
+ });
$flow = new LoginFlowV2();
$this->loginFlowV2Service->method('getByLoginToken')
@@ -235,9 +235,9 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGenerateAppPasswordInvalidStateToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
return null;
- }));
+ });
$result = $this->controller->generateAppPassword('stateToken');
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
@@ -245,7 +245,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGenerateAppPassworInvalidLoginToken() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -253,7 +253,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
return 'loginToken';
}
return null;
- }));
+ });
$this->loginFlowV2Service->method('getByLoginToken')
->with('loginToken')
@@ -265,7 +265,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
public function testGenerateAppPassworValid() {
$this->session->method('get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if ($name === 'client.flow.v2.state.token') {
return 'stateToken';
}
@@ -273,7 +273,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
return 'loginToken';
}
return null;
- }));
+ });
$flow = new LoginFlowV2();
$this->loginFlowV2Service->method('getByLoginToken')
@@ -283,14 +283,14 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$clearedState = false;
$clearedLogin = false;
$this->session->method('remove')
- ->will($this->returnCallback(function ($name) use (&$clearedLogin, &$clearedState) {
+ ->willReturnCallback(function ($name) use (&$clearedLogin, &$clearedState) {
if ($name === 'client.flow.v2.state.token') {
$clearedState = true;
}
if ($name === 'client.flow.v2.login.token') {
$clearedLogin = true;
}
- }));
+ });
$this->session->method('getId')
->willReturn('sessionId');
diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php
index c0d1ea42f41..daccee82705 100644
--- a/tests/Core/Controller/CssControllerTest.php
+++ b/tests/Core/Controller/CssControllerTest.php
@@ -158,13 +158,13 @@ class CssControllerTest extends TestCase {
->willReturn($folder);
$folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($fileName) use ($file) {
if ($fileName === 'file.css') {
return $file;
}
throw new NotFoundException();
- })
+ }
);
$this->request->method('getHeader')
diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php
index 26df6d181ef..4476b3ee6ed 100644
--- a/tests/Core/Controller/JsControllerTest.php
+++ b/tests/Core/Controller/JsControllerTest.php
@@ -158,13 +158,13 @@ class JsControllerTest extends TestCase {
->willReturn($folder);
$folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($fileName) use ($file) {
if ($fileName === 'file.js') {
return $file;
}
throw new NotFoundException();
- })
+ }
);
$this->request->method('getHeader')
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 6a6795a8e82..cddf89527db 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -315,10 +315,10 @@ class LoginControllerTest extends TestCase {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['login_form_autocomplete', true, true],
['lost_password_link', '', false],
- ]));
+ ]);
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
@@ -363,10 +363,10 @@ class LoginControllerTest extends TestCase {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['login_form_autocomplete', true, true],
['lost_password_link', '', false],
- ]));
+ ]);
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('canChangePassword')
@@ -435,7 +435,7 @@ class LoginControllerTest extends TestCase {
'user' => $user,
'redirect_url' => '/apps/files',
])
- ->will($this->returnValue($loginPageUrl));
+ ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
$expected->throttle(['user' => 'MyUserName']);
@@ -475,7 +475,7 @@ class LoginControllerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('jane'));
+ ->willReturn('jane');
$password = 'secret';
$originalUrl = 'another%20url';
@@ -486,7 +486,7 @@ class LoginControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->with()
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config->expects($this->never())
->method('deleteUserValue');
$this->userSession->expects($this->never())
@@ -501,7 +501,7 @@ class LoginControllerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('jane'));
+ ->willReturn('jane');
$password = 'secret';
$originalUrl = 'another%20url';
$redirectUrl = 'http://localhost/another url';
@@ -513,11 +513,11 @@ class LoginControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->with()
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with(urldecode($originalUrl))
- ->will($this->returnValue($redirectUrl));
+ ->willReturn($redirectUrl);
$this->config->expects($this->never())
->method('deleteUserValue');
$this->userSession->expects($this->never())
@@ -558,7 +558,7 @@ class LoginControllerTest extends TestCase {
$this->urlGenerator->expects($this->once())
->method('getAbsoluteURL')
->with(urldecode('/apps/mail'))
- ->will($this->returnValue($redirectUrl));
+ ->willReturn($redirectUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl);
$response = $this->loginController->tryLogin($user, $password, '%2Fapps%2Fmail');
@@ -592,7 +592,7 @@ class LoginControllerTest extends TestCase {
'user' => 'john@doe.com',
'redirect_url' => '/apps/files',
])
- ->will($this->returnValue($loginPageUrl));
+ ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
$expected->throttle(['user' => 'john']);
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 27344102f0a..fdbca1ea3b1 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -110,9 +110,9 @@ class LostControllerTest extends \Test\TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$this->defaults = $this->getMockBuilder('\OCP\Defaults')
->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder(IUserManager::class)
@@ -179,7 +179,7 @@ class LostControllerTest extends \Test\TestCase {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedToken');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->userManager->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
@@ -210,7 +210,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
- ->will($this->returnValue('encryptedToken'));
+ ->willReturn('encryptedToken');
$this->crypto->method('decrypt')
->with(
$this->equalTo('encryptedToken'),
@@ -257,7 +257,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.setPassword', array('userId' => 'ValidTokenUser', 'token' => 'TheOnlyAndOnlyOneTokenToResetThePassword'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$this->initialStateService->expects($this->at(0))
->method('provideInitialState')
@@ -280,10 +280,10 @@ class LostControllerTest extends \Test\TestCase {
$this->userManager
->expects($this->any())
->method('userExists')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array(true, $existingUser),
array(false, $nonExistingUser)
- )));
+ ));
$this->logger->expects($this->exactly(0))
->method('logException');
@@ -307,7 +307,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->any())
->method('getUserValue')
->with($existingUser, 'settings', 'email')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$response = $this->lostController->email($existingUser);
$expectedResponse = new JSONResponse([
'status' => 'success',
@@ -321,7 +321,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -330,7 +330,7 @@ class LostControllerTest extends \Test\TestCase {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->config
->expects($this->once())
->method('setUserValue')
@@ -339,7 +339,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->getMockBuilder('\OC\Mail\Message')
->disableOriginalConstructor()->getMock();
$message
@@ -371,7 +371,7 @@ class LostControllerTest extends \Test\TestCase {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -394,7 +394,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -408,7 +408,7 @@ class LostControllerTest extends \Test\TestCase {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->config
->expects($this->once())
->method('setUserValue')
@@ -417,7 +417,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->getMockBuilder('\OC\Mail\Message')
->disableOriginalConstructor()->getMock();
$message
@@ -449,7 +449,7 @@ class LostControllerTest extends \Test\TestCase {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -472,7 +472,7 @@ class LostControllerTest extends \Test\TestCase {
->expects($this->once())
->method('generate')
->with('21')
- ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ ->willReturn('ThisIsMaybeANotSoSecretToken!');
$this->userManager
->expects($this->any())
->method('get')
@@ -485,12 +485,12 @@ class LostControllerTest extends \Test\TestCase {
$this->timeFactory
->expects($this->once())
->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->urlGenerator
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
- ->will($this->returnValue('https://example.tld/index.php/lostpassword/'));
+ ->willReturn('https://example.tld/index.php/lostpassword/');
$message = $this->createMock(Message::class);
$message
->expects($this->at(0))
@@ -521,7 +521,7 @@ class LostControllerTest extends \Test\TestCase {
$this->mailer
->expects($this->at(1))
->method('createMessage')
- ->will($this->returnValue($message));
+ ->willReturn($message);
$this->mailer
->expects($this->at(2))
->method('send')
@@ -548,7 +548,7 @@ class LostControllerTest extends \Test\TestCase {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -559,7 +559,7 @@ class LostControllerTest extends \Test\TestCase {
$this->config->expects($this->never())
->method('deleteUserValue');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
@@ -577,7 +577,7 @@ class LostControllerTest extends \Test\TestCase {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -589,7 +589,7 @@ class LostControllerTest extends \Test\TestCase {
->method('deleteUserValue')
->with('ValidTokenUser', 'core', 'lostpassword');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
@@ -654,14 +654,14 @@ class LostControllerTest extends \Test\TestCase {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12346));
+ ->willReturn(12346);
$this->userManager
->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
$this->timeFactory
->method('getTime')
- ->will($this->returnValue(12345));
+ ->willReturn(12345);
$this->crypto->method('decrypt')
->with(
@@ -781,7 +781,7 @@ class LostControllerTest extends \Test\TestCase {
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
$this->existingUser->method('getLastLogin')
- ->will($this->returnValue(12344));
+ ->willReturn(12344);
$this->existingUser->expects($this->once())
->method('setPassword')
->with('NewPassword')
@@ -793,7 +793,7 @@ class LostControllerTest extends \Test\TestCase {
->method('deleteUserValue')
->with('ValidTokenUser', 'core', 'lostpassword');
$this->timeFactory->method('getTime')
- ->will($this->returnValue(12348));
+ ->willReturn(12348);
$this->crypto->method('decrypt')
->with(
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
index 40453db5729..fa155500567 100644
--- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php
+++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
@@ -100,11 +100,11 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$expected = new StandaloneTemplateResponse('core', 'twofactorselectchallenge', [
'providers' => [
@@ -131,32 +131,32 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('u2f'));
+ ->willReturn('u2f');
$backupProvider->expects($this->once())
->method('getId')
- ->will($this->returnValue('backup_codes'));
+ ->willReturn('backup_codes');
$this->session->expects($this->once())
->method('exists')
->with('two_factor_auth_error')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->exactly(2))
->method('remove')
->with($this->logicalOr($this->equalTo('two_factor_auth_error'), $this->equalTo('two_factor_auth_error_message')));
$provider->expects($this->once())
->method('getTemplate')
->with($user)
- ->will($this->returnValue($tmpl));
+ ->willReturn($tmpl);
$tmpl->expects($this->once())
->method('fetchPage')
- ->will($this->returnValue('<html/>'));
+ ->willReturn('<html/>');
$expected = new StandaloneTemplateResponse('core', 'twofactorshowchallenge', [
'error' => true,
@@ -177,15 +177,15 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProviderSet')
->with($user)
- ->will($this->returnValue($providerSet));
+ ->willReturn($providerSet);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('select/challenge/url'));
+ ->willReturn('select/challenge/url');
$expected = new RedirectResponse('select/challenge/url');
@@ -198,16 +198,16 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
->with('myprovider', $user, 'token')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = new RedirectResponse(OC_Util::getDefaultPageUrl());
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
@@ -219,11 +219,11 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
@@ -243,15 +243,15 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('select/challenge/url'));
+ ->willReturn('select/challenge/url');
$expected = new RedirectResponse('select/challenge/url');
@@ -264,16 +264,16 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
->with('myprovider', $user, 'token')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->once())
->method('set')
->with('two_factor_auth_error', true);
@@ -283,10 +283,10 @@ class TwoFactorChallengeControllerTest extends TestCase {
'challengeProviderId' => 'myprovider',
'redirect_url' => '/url',
])
- ->will($this->returnValue('files/index/url'));
+ ->willReturn('files/index/url');
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('myprovider'));
+ ->willReturn('myprovider');
$expected = new RedirectResponse('files/index/url');
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url'));
@@ -299,11 +299,11 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('getProvider')
->with($user, 'myprovider')
- ->will($this->returnValue($provider));
+ ->willReturn($provider);
$this->twoFactorManager->expects($this->once())
->method('verifyChallenge')
@@ -321,10 +321,10 @@ class TwoFactorChallengeControllerTest extends TestCase {
'challengeProviderId' => 'myprovider',
'redirect_url' => '/url',
])
- ->will($this->returnValue('files/index/url'));
+ ->willReturn('files/index/url');
$provider->expects($this->once())
->method('getId')
- ->will($this->returnValue('myprovider'));
+ ->willReturn('myprovider');
$expected = new RedirectResponse('files/index/url');
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url'));
@@ -334,7 +334,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$this->twoFactorManager->expects($this->once())
->method('getLoginSetupProviders')
@@ -363,7 +363,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$provider->expects($this->any())
->method('getId')
@@ -389,7 +389,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$provider = $this->createMock(IActivatableAtLogin::class);
$provider->expects($this->any())
->method('getId')
diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php
index b5e43b2999d..78112f09fd6 100644
--- a/tests/Core/Controller/UserControllerTest.php
+++ b/tests/Core/Controller/UserControllerTest.php
@@ -56,12 +56,12 @@ class UserControllerTest extends TestCase {
$this->userManager
->method('get')
- ->will($this->returnCallback(function ($uid) use ($user) {
+ ->willReturnCallback(function ($uid) use ($user) {
if ($uid === 'foo') {
return $user;
}
return null;
- }));
+ });
$expected = new JSONResponse([
'users' => [
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 2198cc7d5b4..ac3a5fbc017 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -100,10 +100,10 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->never())
->method('getUser');
@@ -115,7 +115,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->never())
->method('isLoggedIn');
@@ -147,17 +147,17 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -171,21 +171,21 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -201,18 +201,18 @@ class TwoFactorMiddlewareTest extends TestCase {
->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$twoFactorChallengeController = $this->getMockBuilder('\OC\Core\Controller\TwoFactorChallengeController')
->disableOriginalConstructor()
@@ -226,7 +226,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('test/url'));
+ ->willReturn('test/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('test/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -238,7 +238,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('files.view.index')
- ->will($this->returnValue('redirect/url'));
+ ->willReturn('redirect/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('redirect/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -249,9 +249,9 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector
->method('hasAnnotation')
- ->will($this->returnCallback(function (string $annotation) {
+ ->willReturnCallback(function (string $annotation) {
return $annotation === 'TwoFactorSetUpDoneRequired';
- }));
+ });
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(true);
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php
index bf6902fde65..ebb03425375 100644
--- a/tests/lib/APITest.php
+++ b/tests/lib/APITest.php
@@ -79,7 +79,7 @@ class APITest extends \Test\TestCase {
$request
->expects($this->once())
->method('getScriptName')
- ->will($this->returnValue($scriptName));
+ ->willReturn($scriptName);
$this->assertEquals($expected, $this->invokePrivate(new \OC_API, 'isV2', [$request]));
}
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index 80ddcbbd354..97af541085b 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -190,7 +190,7 @@ class AllConfigTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$resultMock->expects($this->once())
->method('fetchColumn')
- ->will($this->returnValue('valueSetUnchanged'));
+ ->willReturn('valueSetUnchanged');
$connectionMock = $this->createMock(IDBConnection::class);
$connectionMock->expects($this->once())
@@ -198,7 +198,7 @@ class AllConfigTest extends \Test\TestCase {
->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '.
'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'),
$this->equalTo(array('userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged')))
- ->will($this->returnValue($resultMock));
+ ->willReturn($resultMock);
$connectionMock->expects($this->never())
->method('executeUpdate');
@@ -411,7 +411,7 @@ class AllConfigTest extends \Test\TestCase {
->method('getValue')
->with($this->equalTo('dbtype'),
$this->equalTo('sqlite'))
- ->will($this->returnValue(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite')));
+ ->willReturn(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite'));
$config = $this->getConfig($systemConfig);
// preparation - add something to the database
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 0e895b5f999..50c1e13b3f9 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -40,20 +40,20 @@ class AppManagerTest extends TestCase {
$config->expects($this->any())
->method('getValue')
- ->will($this->returnCallback(function ($app, $key, $default) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key, $default) use (&$appConfig) {
return (isset($appConfig[$app]) and isset($appConfig[$app][$key])) ? $appConfig[$app][$key] : $default;
- }));
+ });
$config->expects($this->any())
->method('setValue')
- ->will($this->returnCallback(function ($app, $key, $value) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key, $value) use (&$appConfig) {
if (!isset($appConfig[$app])) {
$appConfig[$app] = array();
}
$appConfig[$app][$key] = $value;
- }));
+ });
$config->expects($this->any())
->method('getValues')
- ->will($this->returnCallback(function ($app, $key) use (&$appConfig) {
+ ->willReturnCallback(function ($app, $key) use (&$appConfig) {
if ($app) {
return $appConfig[$app];
} else {
@@ -65,7 +65,7 @@ class AppManagerTest extends TestCase {
}
return $values;
}
- }));
+ });
return $config;
}
@@ -346,7 +346,7 @@ class AppManagerTest extends TestCase {
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
@@ -357,7 +357,7 @@ class AppManagerTest extends TestCase {
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('bar')));
+ ->willReturn(array('bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
@@ -373,11 +373,11 @@ class AppManagerTest extends TestCase {
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isEnabledForUser('test'));
@@ -410,7 +410,7 @@ class AppManagerTest extends TestCase {
$this->groupManager->expects($this->any())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue(array('foo', 'bar')));
+ ->willReturn(array('foo', 'bar'));
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
@@ -462,11 +462,11 @@ class AppManagerTest extends TestCase {
$manager->expects($this->any())
->method('getAppInfo')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appId) use ($appInfos) {
return $appInfos[$appId];
}
- ));
+ );
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test1', 'installed_version', '1.0.0');
@@ -511,11 +511,11 @@ class AppManagerTest extends TestCase {
$manager->expects($this->any())
->method('getAppInfo')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appId) use ($appInfos) {
return $appInfos[$appId];
}
- ));
+ );
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'yes');
@@ -532,7 +532,7 @@ class AppManagerTest extends TestCase {
$group = $this->createMock(IGroup::class);
$group->expects($this->any())
->method('getGID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php
index 2c566b0ea0a..dc7e1920896 100644
--- a/tests/lib/App/AppStore/Bundles/BundleBase.php
+++ b/tests/lib/App/AppStore/Bundles/BundleBase.php
@@ -41,9 +41,9 @@ abstract class BundleBase extends TestCase {
parent::setUp();
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')
- ->will($this->returnCallback(function ($text, $parameters = []) {
+ ->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
}
public function testGetIdentifier() {
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 38e813dc251..30d1fec6c9e 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1946,14 +1946,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testAppstoreDisabled() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'appstoreenabled') {
return false;
} else if ($var === 'version') {
return '11.0.0.2';
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1965,14 +1965,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testNoInternet() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'has_internet_connection') {
return false;
} else if ($var === 'version') {
return '11.0.0.2';
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
index 8a82322b61c..22e7a8742ec 100644
--- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -41,12 +41,12 @@ class CategoryFetcherTest extends FetcherBase {
public function testAppstoreDisabled() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'appstoreenabled') {
return false;
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -57,12 +57,12 @@ class CategoryFetcherTest extends FetcherBase {
public function testNoInternet() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) {
+ ->willReturnCallback(function($var, $default) {
if ($var === 'has_internet_connection') {
return false;
}
return $default;
- }));
+ });
$this->appData
->expects($this->never())
->method('getFolder');
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 943b53eee64..8312bef5b98 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -32,41 +32,41 @@ class DependencyAnalyzerTest extends TestCase {
->getMock();
$this->platformMock->expects($this->any())
->method('getPhpVersion')
- ->will( $this->returnValue('5.4.3'));
+ ->willReturn( '5.4.3');
$this->platformMock->expects($this->any())
->method('getIntSize')
- ->will( $this->returnValue('4'));
+ ->willReturn( '4');
$this->platformMock->expects($this->any())
->method('getDatabase')
- ->will( $this->returnValue('mysql'));
+ ->willReturn( 'mysql');
$this->platformMock->expects($this->any())
->method('getOS')
- ->will( $this->returnValue('Linux'));
+ ->willReturn( 'Linux');
$this->platformMock->expects($this->any())
->method('isCommandKnown')
- ->will( $this->returnCallback(function($command) {
+ ->willReturnCallback( function($command) {
return ($command === 'grep');
- }));
+ });
$this->platformMock->expects($this->any())
->method('getLibraryVersion')
- ->will( $this->returnCallback(function($lib) {
+ ->willReturnCallback( function($lib) {
if ($lib === 'curl') {
return "2.3.4";
}
return null;
- }));
+ });
$this->platformMock->expects($this->any())
->method('getOcVersion')
- ->will( $this->returnValue('8.0.2'));
+ ->willReturn( '8.0.2');
$this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$this->analyser = new DependencyAnalyzer($this->platformMock, $this->l10nMock);
}
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index ccc694942a1..3fb18979b8a 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -93,7 +93,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -133,7 +133,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->once())
->method('setOutput')
->with($this->equalTo($this->output));
@@ -156,7 +156,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->once())
->method('setHeader')
->with($this->equalTo($statusCode));
@@ -175,7 +175,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$mock->expects($this->once())
->method('callback');
App::main($this->controllerName, $this->controllerMethod, $this->container, []);
@@ -190,7 +190,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -207,7 +207,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
@@ -224,7 +224,7 @@ class AppTest extends \Test\TestCase {
->method('dispatch')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod))
- ->will($this->returnValue($return));
+ ->willReturn($return);
$this->io->expects($this->never())
->method('setOutput');
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index 8eb76d3cb27..0f4b83ff5ca 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -136,7 +136,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$hashSet = false;
$this->session
->method('set')
- ->will($this->returnCallback(function($key, $value) use (&$tokenSet, &$hashSet) {
+ ->willReturnCallback(function($key, $value) use (&$tokenSet, &$hashSet) {
if ($key === 'public_link_authenticated_token' && $value === 'token') {
$tokenSet = true;
return true;
@@ -146,7 +146,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
return true;
}
return false;
- }));
+ });
$this->urlGenerator->method('linkToRoute')
->willReturn('myLink!');
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index b1cb1ceab6f..23ebe6ec984 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -89,7 +89,7 @@ class ControllerTest extends \Test\TestCase {
->getMock();
$this->app->expects($this->any())
->method('getAppName')
- ->will($this->returnValue('apptemplate_advanced'));
+ ->willReturn('apptemplate_advanced');
$this->controller = new ChildController($this->app, $request);
}
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php
index a69980fbb26..67d88c879a3 100644
--- a/tests/lib/AppFramework/Db/MapperTest.php
+++ b/tests/lib/AppFramework/Db/MapperTest.php
@@ -148,7 +148,7 @@ class MapperTest extends MapperTestUtility {
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
- ->will($this->returnValue(3));
+ ->willReturn(3);
$this->mapper = new ExampleMapper($this->db);
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
@@ -168,7 +168,7 @@ class MapperTest extends MapperTestUtility {
$this->db->expects($this->once())
->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
- ->will($this->returnValue(3));
+ ->willReturn(3);
$this->mapper = new ExampleMapper($this->db);
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php
index 83156a3932b..cddf015cbea 100644
--- a/tests/lib/AppFramework/Db/MapperTestUtility.php
+++ b/tests/lib/AppFramework/Db/MapperTestUtility.php
@@ -124,7 +124,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->query->expects($this->any())
->method('fetch')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function() use ($iterators, $fetchAt){
$iterator = $iterators[$fetchAt];
$result = $iterator->next();
@@ -137,7 +137,7 @@ abstract class MapperTestUtility extends \Test\TestCase {
return $result;
}
- ));
+ );
if ($this->isAssocArray($arguments)) {
foreach($arguments as $key => $argument) {
@@ -165,9 +165,9 @@ abstract class MapperTestUtility extends \Test\TestCase {
$this->query->expects($this->at($this->queryAt))
->method('execute')
- ->will($this->returnCallback(function($sql, $p=null, $o=null, $s=null) {
+ ->willReturnCallback(function($sql, $p=null, $o=null, $s=null) {
- }));
+ });
$this->queryAt++;
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index 1c4dc067b5d..494f19a6d24 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -156,7 +156,7 @@ class DispatcherTest extends \Test\TestCase {
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($exception))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
} else {
$this->middlewareDispatcher->expects($this->once())
->method('afterException')
@@ -173,51 +173,51 @@ class DispatcherTest extends \Test\TestCase {
$this->equalTo($this->controllerMethod));
$this->controller->expects($this->once())
->method($this->controllerMethod)
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
}
$this->response->expects($this->once())
->method('render')
- ->will($this->returnValue($out));
+ ->willReturn($out);
$this->response->expects($this->once())
->method('getStatus')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->response->expects($this->once())
->method('getLastModified')
- ->will($this->returnValue($this->lastModified));
+ ->willReturn($this->lastModified);
$this->response->expects($this->once())
->method('getETag')
- ->will($this->returnValue($this->etag));
+ ->willReturn($this->etag);
$this->response->expects($this->once())
->method('getHeaders')
- ->will($this->returnValue($responseHeaders));
+ ->willReturn($responseHeaders);
$this->http->expects($this->once())
->method('getStatusHeader')
->with($this->equalTo(Http::STATUS_OK),
$this->equalTo($this->lastModified),
$this->equalTo($this->etag))
- ->will($this->returnValue($httpHeaders));
+ ->willReturn($httpHeaders);
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($this->response))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($this->response))
- ->will($this->returnValue($this->response));
+ ->willReturn($this->response);
$this->middlewareDispatcher->expects($this->once())
->method('beforeOutput')
->with($this->equalTo($this->controller),
$this->equalTo($this->controllerMethod),
$this->equalTo($out))
- ->will($this->returnValue($out));
+ ->willReturn($out);
}
@@ -281,14 +281,14 @@ class DispatcherTest extends \Test\TestCase {
->method('beforeController');
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
- ->will($this->returnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function($a, $b, $in) {
return $in;
- }));
+ });
$this->middlewareDispatcher->expects($this->once())
->method('beforeOutput')
- ->will($this->returnCallback(function($a, $b, $in) {
+ ->willReturnCallback(function($a, $b, $in) {
return $in;
- }));
+ });
}
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index be019050e1b..67fef79dcff 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -378,7 +378,7 @@ class RequestTest extends \Test\TestCase {
$this->secureRandom->expects($this->once())
->method('generate')
->with('20')
- ->will($this->returnValue('GeneratedByOwnCloudItself'));
+ ->willReturn('GeneratedByOwnCloudItself');
$request = new Request(
[],
@@ -409,7 +409,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -433,12 +433,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$request = new Request(
[
@@ -462,12 +462,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -491,12 +491,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED']));
+ ->willReturn(['HTTP_X_FORWARDED']);
$request = new Request(
[
@@ -520,16 +520,16 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['10.0.0.2']));
+ ->willReturn(['10.0.0.2']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -553,16 +553,16 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348']));
+ ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue([
+ ->willReturn([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED'
- ]));
+ ]);
$request = new Request(
[
@@ -586,12 +586,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('forwarded_for_headers')
- ->will($this->returnValue(['HTTP_X_FORWARDED_FOR']));
+ ->willReturn(['HTTP_X_FORWARDED_FOR']);
$request = new Request(
[
@@ -615,7 +615,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('trusted_proxies')
- ->will($this->returnValue(['192.168.2.0/24']));
+ ->willReturn(['192.168.2.0/24']);
$request = new Request(
[
@@ -690,17 +690,17 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwriteprotocol')
- ->will($this->returnValue('customProtocol'));
+ ->willReturn('customProtocol');
$request = new Request(
[],
@@ -716,13 +716,13 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithProtoValid() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$requestHttps = new Request(
[
@@ -757,9 +757,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOn() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -778,9 +778,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueOff() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -799,9 +799,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithHttpsServerValueEmpty() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[
@@ -820,9 +820,9 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolDefault() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
return $default;
- }));
+ });
$request = new Request(
[],
@@ -837,13 +837,13 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolBehindLoadBalancers() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1059,13 +1059,13 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1088,13 +1088,13 @@ class RequestTest extends \Test\TestCase {
public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1117,7 +1117,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithOverwriteHost() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'overwritecondaddr') {
return '';
} else if ($key === 'overwritehost') {
@@ -1125,7 +1125,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[],
@@ -1141,7 +1141,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1149,7 +1149,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1170,7 +1170,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithUntrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
} else if ($key === 'trusted_domains') {
@@ -1178,7 +1178,7 @@ class RequestTest extends \Test\TestCase {
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1199,12 +1199,12 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithNoTrustedDomain() {
$this->config
->method('getSystemValue')
- ->will($this->returnCallback(function($key, $default) {
+ ->willReturnCallback(function($key, $default) {
if ($key === 'trusted_proxies') {
return ['1.2.3.4'];
}
return $default;
- }));
+ });
$request = new Request(
[
@@ -1273,7 +1273,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[],
$this->secureRandom,
@@ -1290,17 +1290,17 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('www.owncloud.org'));
+ ->willReturn('www.owncloud.org');
$request = new Request(
[],
@@ -1485,7 +1485,7 @@ class RequestTest extends \Test\TestCase {
->expects($this->once())
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue(''));
+ ->willReturn('');
$request = new Request(
[
@@ -1517,12 +1517,12 @@ class RequestTest extends \Test\TestCase {
->expects($this->at(0))
->method('getSystemValue')
->with('overwritewebroot')
- ->will($this->returnValue($overwriteWebRoot));
+ ->willReturn($overwriteWebRoot);
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('overwritecondaddr')
- ->will($this->returnValue($overwriteCondAddr));
+ ->willReturn($overwriteCondAddr);
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1542,7 +1542,7 @@ class RequestTest extends \Test\TestCase {
$request
->expects($this->once())
->method('getScriptName')
- ->will($this->returnValue('/scriptname.php'));
+ ->willReturn('/scriptname.php');
$this->assertSame($expectedUri, $request->getRequestUri());
}
diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php
index ef7132013b6..b66d9c5ed1d 100644
--- a/tests/lib/AppFramework/Http/StreamResponseTest.php
+++ b/tests/lib/AppFramework/Http/StreamResponseTest.php
@@ -44,7 +44,7 @@ class StreamResponseTest extends \Test\TestCase {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_NOT_MODIFIED));
+ ->willReturn(Http::STATUS_NOT_MODIFIED);
$this->output->expects($this->never())
->method('setReadfile');
$response = new StreamResponse($path);
@@ -56,11 +56,11 @@ class StreamResponseTest extends \Test\TestCase {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->once())
->method('setReadfile')
->with($this->equalTo($path))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$response = new StreamResponse($path);
$response->callback($this->output);
@@ -70,7 +70,7 @@ class StreamResponseTest extends \Test\TestCase {
$path = __FILE__ . 'test';
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->never())
->method('setReadfile');
$this->output->expects($this->once())
@@ -85,10 +85,10 @@ class StreamResponseTest extends \Test\TestCase {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
- ->will($this->returnValue(Http::STATUS_OK));
+ ->willReturn(Http::STATUS_OK);
$this->output->expects($this->once())
->method('setReadfile')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->output->expects($this->once())
->method('setHttpResponseCode')
->with($this->equalTo(Http::STATUS_BAD_REQUEST));
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index 965637cb4c4..4790e9baca7 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -158,7 +158,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
->getMock();
$m2->expects($this->once())
->method('afterException')
- ->will($this->returnValue($response));
+ ->willReturn($response);
$this->dispatcher->registerMiddleware($m1);
$this->dispatcher->registerMiddleware($m2);
@@ -282,7 +282,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
$m3->expects($this->never())
->method('afterController');
$m3->method('beforeOutput')
- ->will($this->returnArgument(2));
+ ->willReturnArgument(2);
$this->dispatcher->registerMiddleware($m3);
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index 1c12a4aa153..691553a13d8 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -140,7 +140,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->session->expects($this->never())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reflector->reflect($this, __FUNCTION__);
$middleware->beforeController($this->controller, __FUNCTION__);
@@ -163,7 +163,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->session->expects($this->once())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
@@ -215,7 +215,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->session->expects($this->once())
->method('logClientIn')
->with($this->equalTo('user'), $this->equalTo('pass'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index ae0e6ff484d..5a8260d7968 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -218,7 +218,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
public function testNoChecks(){
$this->request->expects($this->never())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$sec = $this->getMiddleware(false, false, false);
@@ -262,10 +262,10 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
}
@@ -278,7 +278,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
public function testNoCsrfCheck(){
$this->request->expects($this->never())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -290,10 +290,10 @@ class SecurityMiddlewareTest extends \Test\TestCase {
public function testPassesCsrfCheck(){
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -307,10 +307,10 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->request->expects($this->once())
->method('passesCSRFCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -327,7 +327,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
->method('passesCSRFCheck');
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -341,7 +341,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
public function testNoStrictCookieRequiredCheck() {
$this->request->expects($this->never())
->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->reader->reflect(__CLASS__, __FUNCTION__);
$this->middleware->beforeController($this->controller, __FUNCTION__);
@@ -393,7 +393,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
public function testCsrfOcsController(Controller $controller, bool $hasOcsApiHeader, bool $hasBearerAuth, bool $exception) {
$this->request
->method('getHeader')
- ->will(self::returnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) {
+ ->willReturnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) {
if ($header === 'OCS-APIREQUEST' && $hasOcsApiHeader) {
return 'true';
}
@@ -401,7 +401,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
return 'Bearer TOKEN!';
}
return '';
- }));
+ });
$this->request->expects($this->once())
->method('passesStrictCookieCheck')
->willReturn(true);
@@ -511,7 +511,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
'redirect_url' => 'nextcloud/index.php/apps/specialapp',
]
)
- ->will($this->returnValue('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'));
+ ->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp');
$this->logger
->expects($this->once())
->method('logException');
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index 1b7ab054a0f..4d184adcdb1 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -245,7 +245,7 @@ class RoutingTest extends \Test\TestCase
->expects($this->once())
->method('create')
->with($this->equalTo('app1.' . $name), $this->equalTo($url))
- ->will($this->returnValue($route));
+ ->willReturn($route);
// load route configuration
$config = new RouteConfig($container, $router, $routes);
@@ -293,7 +293,7 @@ class RoutingTest extends \Test\TestCase
->expects($this->once())
->method('create')
->with($this->equalTo('ocs.app1.' . $name), $this->equalTo($url))
- ->will($this->returnValue($route));
+ ->willReturn($route);
// load route configuration
$config = new RouteConfig($container, $router, $routes);
@@ -391,31 +391,31 @@ class RoutingTest extends \Test\TestCase
->expects($this->at(0))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.index'), $this->equalTo($url))
- ->will($this->returnValue($indexRoute));
+ ->willReturn($indexRoute);
$router
->expects($this->at(1))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.show'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($showRoute));
+ ->willReturn($showRoute);
$router
->expects($this->at(2))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.create'), $this->equalTo($url))
- ->will($this->returnValue($createRoute));
+ ->willReturn($createRoute);
$router
->expects($this->at(3))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.update'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($updateRoute));
+ ->willReturn($updateRoute);
$router
->expects($this->at(4))
->method('create')
->with($this->equalTo('app1.' . $resourceName . '.destroy'), $this->equalTo($urlWithParam))
- ->will($this->returnValue($destroyRoute));
+ ->willReturn($destroyRoute);
// load route configuration
$config = new RouteConfig($container, $router, $yaml);
@@ -448,20 +448,20 @@ class RoutingTest extends \Test\TestCase
->expects($this->exactly(1))
->method('method')
->with($this->equalTo($verb))
- ->will($this->returnValue($route));
+ ->willReturn($route);
$route
->expects($this->exactly(1))
->method('action')
->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName)))
- ->will($this->returnValue($route));
+ ->willReturn($route);
if(count($requirements) > 0) {
$route
->expects($this->exactly(1))
->method('requirements')
->with($this->equalTo($requirements))
- ->will($this->returnValue($route));
+ ->willReturn($route);
}
if (count($defaults) > 0) {
@@ -469,7 +469,7 @@ class RoutingTest extends \Test\TestCase
->expects($this->exactly(1))
->method('defaults')
->with($this->equalTo($defaults))
- ->will($this->returnValue($route));
+ ->willReturn($route);
}
return $route;
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 412db90849b..3ec70d7142a 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -469,7 +469,7 @@ class AppTest extends \Test\TestCase {
$this->setupAppConfigMock()->expects($this->once())
->method('getValues')
- ->will($this->returnValue(
+ ->willReturn(
array(
'app3' => 'yes',
'app2' => 'no',
@@ -478,7 +478,7 @@ class AppTest extends \Test\TestCase {
'appforgroup2' => '["group2"]',
'appforgroup12' => '["group2","group1"]',
)
- )
+
);
$apps = \OC_App::getEnabledApps(false, $forceAll);
@@ -508,12 +508,12 @@ class AppTest extends \Test\TestCase {
$this->setupAppConfigMock()->expects($this->once())
->method('getValues')
- ->will($this->returnValue(
+ ->willReturn(
array(
'app3' => 'yes',
'app2' => 'no',
)
- )
+
);
$apps = \OC_App::getEnabledApps();
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index b4e5e097847..a1287680317 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -64,7 +64,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->time = 1313131;
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnValue($this->time));
+ ->willReturn($this->time);
$this->tokenProvider = new DefaultTokenProvider($this->mapper, $this->crypto, $this->config, $this->logger,
$this->timeFactory);
@@ -96,11 +96,11 @@ class DefaultTokenProviderTest extends TestCase {
$this->config->expects($this->any())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('encrypt')
->with($password, $token . '1f4h9s')
- ->will($this->returnValue('encryptedpassword'));
+ ->willReturn('encryptedpassword');
$this->mapper->expects($this->once())
->method('insert')
->with($this->equalTo($toInsert));
@@ -136,7 +136,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
- ->will($this->returnValue(['token']));
+ ->willReturn(['token']);
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
@@ -148,11 +148,11 @@ class DefaultTokenProviderTest extends TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('decrypt')
->with('someencryptedvalue', $token . '1f4h9s')
- ->will($this->returnValue('passme'));
+ ->willReturn('passme');
$actual = $this->tokenProvider->getPassword($tk, $token);
@@ -188,7 +188,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('1f4h9s'));
+ ->willReturn('1f4h9s');
$this->crypto->expects($this->once())
->method('decrypt')
->with('someencryptedvalue', $token . '1f4h9s')
@@ -208,11 +208,11 @@ class DefaultTokenProviderTest extends TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('secret')
- ->will($this->returnValue('ocsecret'));
+ ->willReturn('ocsecret');
$this->crypto->expects($this->once())
->method('encrypt')
->with($password, $tokenId . 'ocsecret')
- ->will($this->returnValue('encryptedpassword'));
+ ->willReturn('encryptedpassword');
$this->mapper->expects($this->once())
->method('update')
->with($token);
@@ -256,10 +256,10 @@ class DefaultTokenProviderTest extends TestCase {
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
$this->config->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
- ]));
+ ]);
$this->mapper->expects($this->at(0))
->method('invalidateOld')
->with($this->time - 150);
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 3fa7a92bb9b..c9dc3d6ef4a 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -61,12 +61,12 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->crypto = \OC::$server->getCrypto();
$this->config = $this->createMock(IConfig::class);
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', 60 * 60 * 24, 150],
['remember_login_cookie_lifetime', 60 * 60 * 24 * 15, 300],
['secret', '', '1f4h9s'],
['openssl', [], []],
- ]));
+ ]);
$this->logger = $this->createMock(ILogger::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->time = 1313131;
@@ -124,7 +124,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
- ->will($this->returnValue(['token']));
+ ->willReturn(['token']);
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
@@ -239,10 +239,10 @@ class PublicKeyTokenProviderTest extends TestCase {
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
$this->config->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
- ]));
+ ]);
$this->mapper->expects($this->at(0))
->method('invalidateOld')
->with($this->time - 150);
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index 63d0e993f3b..b5cea26e73f 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -126,7 +126,7 @@ class ManagerTest extends TestCase {
private function prepareNoProviders() {
$this->providerLoader->method('getProviders')
->with($this->user)
- ->will($this->returnValue([]));
+ ->willReturn([]);
}
private function prepareProviders() {
@@ -366,11 +366,11 @@ class ManagerTest extends TestCase {
$this->fakeProvider->expects($this->once())
->method('verifyChallenge')
->with($this->user, $challenge)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->once())
->method('get')
->with('two_factor_remember_login')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->at(1))
->method('remove')
->with('two_factor_auth_uid');
@@ -449,7 +449,7 @@ class ManagerTest extends TestCase {
$this->fakeProvider->expects($this->once())
->method('verifyChallenge')
->with($this->user, $challenge)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->never())
->method('remove');
$this->activityManager->expects($this->once())
@@ -496,7 +496,7 @@ class ManagerTest extends TestCase {
$this->session->expects($this->at(1))
->method('exists')
->with('two_factor_auth_uid')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->session->expects($this->at(2))
->method('exists')
->with(Manager::SESSION_UID_DONE)
@@ -557,7 +557,7 @@ class ManagerTest extends TestCase {
$this->session->expects($this->never())
->method('exists')
->with('two_factor_auth_uid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->session->expects($this->never())
->method('remove')
->with('two_factor_auth_uid');
@@ -567,7 +567,7 @@ class ManagerTest extends TestCase {
public function testPrepareTwoFactorLogin() {
$this->user->method('getUID')
- ->will($this->returnValue('ferdinand'));
+ ->willReturn('ferdinand');
$this->session->expects($this->at(0))
->method('set')
@@ -597,7 +597,7 @@ class ManagerTest extends TestCase {
public function testPrepareTwoFactorLoginDontRemember() {
$this->user->method('getUID')
- ->will($this->returnValue('ferdinand'));
+ ->willReturn('ferdinand');
$this->session->expects($this->at(0))
->method('set')
@@ -630,14 +630,14 @@ class ManagerTest extends TestCase {
->willReturn('user');
$this->session->method('exists')
- ->will($this->returnCallback(function ($var) {
+ ->willReturnCallback(function ($var) {
if ($var === Manager::SESSION_UID_KEY) {
return false;
} else if ($var === 'app_password') {
return false;
}
return true;
- }));
+ });
$this->session->expects($this->once())
->method('get')
->with(Manager::SESSION_UID_DONE)
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
index f3762976837..60635d48877 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
@@ -63,14 +63,14 @@ class ProviderLoaderTest extends TestCase {
->willReturn(['mail', 'twofactor_totp']);
$this->appManager
->method('getAppInfo')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail', false, null, []],
['twofactor_totp', false, null, [
'two-factor-providers' => [
'\\OCA\\MyFaulty2faApp\\DoesNotExist',
],
]],
- ]));
+ ]);
$this->loader->getProviders($this->user);
}
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index 43e325b0941..11bb33a9741 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -57,18 +57,18 @@ class UserAvatarTest extends \Test\TestCase {
->willReturn($file);
$this->folder->method('getFile')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'avatar.64.png') {
throw new NotFoundException();
}
- }));
+ });
$this->folder->method('fileExists')
- ->will($this->returnCallback(function($path) {
+ ->willReturnCallback(function($path) {
if ($path === 'generated') {
return true;
}
return false;
- }));
+ });
$data = NULL;
$file->method('putContent')
@@ -85,10 +85,10 @@ class UserAvatarTest extends \Test\TestCase {
public function testGetAvatarSizeMatch() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
['avatar.128.jpg', true],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -102,9 +102,9 @@ class UserAvatarTest extends \Test\TestCase {
public function testGetAvatarSizeMinusOne() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -118,10 +118,10 @@ class UserAvatarTest extends \Test\TestCase {
public function testGetAvatarNoSizeMatch() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.png', true],
['avatar.32.png', false],
- ]));
+ ]);
$expected = new \OC_Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
@@ -133,7 +133,7 @@ class UserAvatarTest extends \Test\TestCase {
$file->method('getContent')->willReturn($expected->data());
$this->folder->method('getFile')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($path) use ($file) {
if ($path === 'avatar.png') {
return $file;
@@ -141,7 +141,7 @@ class UserAvatarTest extends \Test\TestCase {
throw new \OCP\Files\NotFoundException;
}
}
- ));
+ );
$newFile = $this->createMock(File::class);
$newFile->expects($this->once())
@@ -164,19 +164,19 @@ class UserAvatarTest extends \Test\TestCase {
public function testExiststJPG() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', true],
['avatar.png', false],
- ]));
+ ]);
$this->assertTrue($this->avatar->exists());
}
public function testExistsPNG() {
$this->folder->method('fileExists')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['avatar.jpg', false],
['avatar.png', true],
- ]));
+ ]);
$this->assertTrue($this->avatar->exists());
}
@@ -282,7 +282,7 @@ class UserAvatarTest extends \Test\TestCase {
{
/** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */
$l = $this->createMock(IL10N::class);
- $l->method('t')->will($this->returnArgument(0));
+ $l->method('t')->willReturnArgument(0);
return new \OC\Avatar\UserAvatar(
$this->folder,
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 7e099b23d06..6e99a71d1e3 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -150,7 +150,7 @@ class JobListTest extends TestCase {
$this->config->expects($this->once())
->method('getAppValue')
->with('backgroundjob', 'lastjob', 0)
- ->will($this->returnValue(15));
+ ->willReturn(15);
$this->assertEquals(15, $this->instance->getLastJob());
}
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php
index 450bdf607b3..cadeb502b4f 100644
--- a/tests/lib/Cache/FileCacheTest.php
+++ b/tests/lib/Cache/FileCacheTest.php
@@ -127,11 +127,11 @@ class FileCacheTest extends TestCache {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$mockStorage->expects($this->once())
->method('unlink')
->with('key1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->instance->set('key1', 'value1');
$this->instance->gc();
@@ -142,7 +142,7 @@ class FileCacheTest extends TestCache {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(time() + 3600));
+ ->willReturn(time() + 3600);
$mockStorage->expects($this->never())
->method('unlink')
->with('key1');
@@ -165,7 +165,7 @@ class FileCacheTest extends TestCache {
$mockStorage->expects($this->atLeastOnce())
->method('filemtime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$mockStorage->expects($this->atLeastOnce())
->method('unlink')
->will($this->onConsecutiveCalls(
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index fa459203dac..5f98188799b 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -44,19 +44,19 @@ class ManagerTest extends TestCase {
public function testSearch($search1, $search2, $expected) {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('simple:1'));
+ $calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
->method('search')
->with('', [], [], null, null)
- ->will($this->returnValue($search1));
+ ->willReturn($search1);
/** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('simple:2'));
+ $calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
->method('search')
->with('', [], [], null, null)
- ->will($this->returnValue($search2));
+ ->willReturn($search2);
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -71,21 +71,21 @@ class ManagerTest extends TestCase {
public function testSearchOptions($search1, $search2, $expected) {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('simple:1'));
+ $calendar1->method('getKey')->willReturn('simple:1');
$calendar1->expects($this->once())
->method('search')
->with('searchTerm', ['SUMMARY', 'DESCRIPTION'],
['timerange' => ['start' => null, 'end' => null]], 5, 20)
- ->will($this->returnValue($search1));
+ ->willReturn($search1);
/** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('simple:2'));
+ $calendar2->method('getKey')->willReturn('simple:2');
$calendar2->expects($this->once())
->method('search')
->with('searchTerm', ['SUMMARY', 'DESCRIPTION'],
['timerange' => ['start' => null, 'end' => null]], 5, 20)
- ->will($this->returnValue($search2));
+ ->willReturn($search2);
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -152,11 +152,11 @@ class ManagerTest extends TestCase {
public function testRegisterUnregister() {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('key1'));
+ $calendar1->method('getKey')->willReturn('key1');
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('key2'));
+ $calendar2->method('getKey')->willReturn('key2');
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
@@ -176,11 +176,11 @@ class ManagerTest extends TestCase {
public function testGetCalendars() {
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
- $calendar1->method('getKey')->will($this->returnValue('key1'));
+ $calendar1->method('getKey')->willReturn('key1');
/** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */
$calendar2 = $this->createMock(ICalendar::class);
- $calendar2->method('getKey')->will($this->returnValue('key2'));
+ $calendar2->method('getKey')->willReturn('key2');
$this->manager->registerCalendar($calendar1);
$this->manager->registerCalendar($calendar2);
diff --git a/tests/lib/Calendar/Resource/ManagerTest.php b/tests/lib/Calendar/Resource/ManagerTest.php
index 71679a86a8c..30b0e16c948 100644
--- a/tests/lib/Calendar/Resource/ManagerTest.php
+++ b/tests/lib/Calendar/Resource/ManagerTest.php
@@ -45,18 +45,18 @@ class ManagerTest extends TestCase {
public function testRegisterUnregisterBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
@@ -74,18 +74,18 @@ class ManagerTest extends TestCase {
public function testGetBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
@@ -96,18 +96,18 @@ class ManagerTest extends TestCase {
public function testClear() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_resource_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_resource_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_resource_backend1');
$this->manager->registerBackend('calendar_resource_backend2');
diff --git a/tests/lib/Calendar/Room/ManagerTest.php b/tests/lib/Calendar/Room/ManagerTest.php
index 56f05544e29..b01d16945ad 100644
--- a/tests/lib/Calendar/Room/ManagerTest.php
+++ b/tests/lib/Calendar/Room/ManagerTest.php
@@ -45,18 +45,18 @@ class ManagerTest extends TestCase {
public function testRegisterUnregisterBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
@@ -74,18 +74,18 @@ class ManagerTest extends TestCase {
public function testGetBackend() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
@@ -96,18 +96,18 @@ class ManagerTest extends TestCase {
public function testClear() {
$backend1 = $this->createMock(IBackend::class);
- $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1'));
+ $backend1->method('getBackendIdentifier')->willReturn('backend_1');
$this->server->expects($this->at(0))
->method('query')
->with('calendar_room_backend1')
- ->will($this->returnValue($backend1));
+ ->willReturn($backend1);
$backend2 = $this->createMock(IBackend::class);
- $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2'));
+ $backend2->method('getBackendIdentifier')->willReturn('backend_2');
$this->server->expects($this->at(1))
->method('query')
->with('calendar_room_backend2')
- ->will($this->returnValue($backend2));
+ ->willReturn($backend2);
$this->manager->registerBackend('calendar_room_backend1');
$this->manager->registerBackend('calendar_room_backend2');
diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php
index 6fa86a2e855..594d17168d6 100644
--- a/tests/lib/Command/Integrity/SignAppTest.php
+++ b/tests/lib/Command/Integrity/SignAppTest.php
@@ -59,17 +59,17 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('PrivateKey'));
+ ->willReturn('PrivateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -87,17 +87,17 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -115,17 +115,17 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$outputInterface
->expects($this->at(0))
@@ -143,23 +143,23 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -177,28 +177,28 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key');
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with('certificate')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -216,17 +216,17 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -260,17 +260,17 @@ class SignAppTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('path')
- ->will($this->returnValue('AppId'));
+ ->willReturn('AppId');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php
index 9bab016ec8f..36376ef0e7d 100644
--- a/tests/lib/Command/Integrity/SignCoreTest.php
+++ b/tests/lib/Command/Integrity/SignCoreTest.php
@@ -54,12 +54,12 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('Certificate'));
+ ->willReturn('Certificate');
$outputInterface
->expects($this->at(0))
@@ -77,12 +77,12 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$outputInterface
->expects($this->at(0))
@@ -100,23 +100,23 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with('privateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -134,17 +134,17 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -155,7 +155,7 @@ class SignCoreTest extends TestCase {
->expects($this->at(1))
->method('file_get_contents')
->with('certificate')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$outputInterface
->expects($this->at(0))
@@ -173,17 +173,17 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
@@ -217,17 +217,17 @@ class SignCoreTest extends TestCase {
->expects($this->at(0))
->method('getOption')
->with('privateKey')
- ->will($this->returnValue('privateKey'));
+ ->willReturn('privateKey');
$inputInterface
->expects($this->at(1))
->method('getOption')
->with('certificate')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$inputInterface
->expects($this->at(2))
->method('getOption')
->with('path')
- ->will($this->returnValue('certificate'));
+ ->willReturn('certificate');
$this->fileAccessHelper
->expects($this->at(0))
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 93cafc0f933..1700af797fe 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -339,7 +339,7 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('comment_test'));
+ ->willReturn('comment_test');
$manager = $this->getManager();
@@ -679,7 +679,7 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
@@ -696,7 +696,7 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime('yesterday');
@@ -716,7 +716,7 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
@@ -734,7 +734,7 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('alice'));
+ ->willReturn('alice');
$dateTimeSet = new \DateTime();
diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
index 10584812c41..8df04086ab6 100644
--- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
@@ -80,10 +80,10 @@ class ActionProviderStoreTest extends TestCase {
]);
$this->serverContainer->expects($this->exactly(2))
->method('query')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[EMailProvider::class, true, $provider1],
['OCA\Contacts\Provider1', true, $provider2]
- ]));
+ ]);
$providers = $this->actionProviderStore->getProviders($user);
@@ -105,9 +105,9 @@ class ActionProviderStoreTest extends TestCase {
->willReturn([/* Empty info.xml */]);
$this->serverContainer->expects($this->once())
->method('query')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[EMailProvider::class, true, $provider1],
- ]));
+ ]);
$providers = $this->actionProviderStore->getProviders($user);
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php
index 9e8b75fbf4d..f39d849bb95 100644
--- a/tests/lib/ContactsManagerTest.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -227,10 +227,10 @@ class ContactsManagerTest extends \Test\TestCase {
// setup return for method calls
$addressbook->expects($this->any())
->method('getKey')
- ->will($this->returnValue('SIMPLE_ADDRESS_BOOK'));
+ ->willReturn('SIMPLE_ADDRESS_BOOK');
$addressbook->expects($this->any())
->method('getDisplayName')
- ->will($this->returnValue('A very simple Addressbook'));
+ ->willReturn('A very simple Addressbook');
// register the address book
$this->cm->registerAddressBook($addressbook);
diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php
index 3b44f15f756..5698ad966f1 100644
--- a/tests/lib/DB/MDB2SchemaReaderTest.php
+++ b/tests/lib/DB/MDB2SchemaReaderTest.php
@@ -38,10 +38,10 @@ class MDB2SchemaReaderTest extends TestCase {
->getMock();
$config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array('dbname', 'owncloud', 'testDB'),
array('dbtableprefix', 'oc_', 'test_')
- )));
+ ));
return $config;
}
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index 31936a4176b..b333729ef87 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -335,7 +335,7 @@ class StorageTest extends TestCase {
->willReturn(true);
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
@@ -366,7 +366,7 @@ class StorageTest extends TestCase {
->willReturn(true);
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
@@ -432,7 +432,7 @@ class StorageTest extends TestCase {
$this->util->expects($this->any())
->method('getUidAndFilename')
- ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ ->willReturnCallback(array($this, 'getUidAndFilenameCallback'));
$this->util->expects($this->any())
->method('isSystemWideMountPoint')
->willReturn($systemWideMountPoint);
@@ -460,7 +460,7 @@ class StorageTest extends TestCase {
->willReturn(false);
$this->view->expects($this->any())
->method('mkdir')
- ->will($this->returnCallback(array($this, 'mkdirCallback')));
+ ->willReturnCallback(array($this, 'mkdirCallback'));
$this->mkdirStack = array(
'/user1/files_encryption/keys/foo',
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index e503da109a8..2c5bd1a80f3 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -120,7 +120,7 @@ class UtilTest extends TestCase {
$this->userManager
->expects($this->any())
->method('userExists')
- ->will($this->returnCallback(array($this, 'isExcludedCallback')));
+ ->willReturnCallback(array($this, 'isExcludedCallback'));
$this->assertSame($expected,
$this->util->isExcluded($path)
diff --git a/tests/lib/FileChunkingTest.php b/tests/lib/FileChunkingTest.php
index 75a6913d4ad..7cbabe697a4 100644
--- a/tests/lib/FileChunkingTest.php
+++ b/tests/lib/FileChunkingTest.php
@@ -61,10 +61,10 @@ class FileChunkingTest extends \Test\TestCase {
$cache->expects($this->atLeastOnce())
->method('hasKey')
- ->will($this->returnCallback(function ($key) use ($present) {
+ ->willReturnCallback(function ($key) use ($present) {
$data = explode('-', $key);
return in_array($data[3], $present);
- }));
+ });
$fileChunking->method('getCache')->willReturn($cache);
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index b2816c03094..247ed9ef9ec 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -544,7 +544,7 @@ class CacheTest extends \Test\TestCase {
$cacheMock->expects($this->any())
->method('normalize')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php
index 2f61f634ffb..6f347a504cb 100644
--- a/tests/lib/Files/Config/UserMountCacheTest.php
+++ b/tests/lib/Files/Config/UserMountCacheTest.php
@@ -77,24 +77,24 @@ class UserMountCacheTest extends TestCase {
->getMock();
$storageCache->expects($this->any())
->method('getNumericId')
- ->will($this->returnValue($storageId));
+ ->willReturn($storageId);
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
->disableOriginalConstructor()
->getMock();
$cache->expects($this->any())
->method('getId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$storage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
->method('getStorageCache')
- ->will($this->returnValue($storageCache));
+ ->willReturn($storageCache);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
return [$storage, $rootId];
}
@@ -401,7 +401,7 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -434,7 +434,7 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($folderId));
+ ->willReturn($folderId);
$this->cache->registerMounts($user1, [$mount1]);
@@ -481,11 +481,11 @@ class UserMountCacheTest extends TestCase {
$mount1->expects($this->any())
->method('getStorageRootId')
- ->will($this->returnValue($rootId));
+ ->willReturn($rootId);
$mount1->expects($this->any())
->method('getNumericStorageId')
- ->will($this->returnValue(2));
+ ->willReturn(2);
$this->cache->registerMounts($user1, [$mount1]);
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index 9b63c507b5f..800b360415a 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -21,12 +21,12 @@ class MountPointTest extends \Test\TestCase {
$storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
- ->will($this->returnValue(123));
+ ->willReturn(123);
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mountPoint = new \OC\Files\Mount\MountPoint(
// just use this because a real class is needed
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 2cdf9cbdc5a..69d31b28a96 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -48,12 +48,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('file_get_contents')
->with('/bar/foo')
- ->will($this->returnValue('bar'));
+ ->willReturn('bar');
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('bar', $node->getContent());
@@ -70,12 +70,12 @@ class FileTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->getContent();
@@ -89,17 +89,17 @@ class FileTest extends NodeTest {
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$this->view->expects($this->once())
->method('file_put_contents')
->with('/bar/foo', 'bar')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -117,7 +117,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->putContent('bar');
@@ -132,7 +132,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('mimetype' => 'text/plain')));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$this->assertEquals('text/plain', $node->getMimeType());
@@ -162,12 +162,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'r')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('r');
@@ -197,12 +197,12 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('fopen')
->with('/bar/foo', 'w')
- ->will($this->returnValue($stream));
+ ->willReturn($stream);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$fh = $node->fopen('w');
@@ -232,7 +232,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => 0))));
+ ->willReturn($this->getFileInfo(array('permissions' => 0)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('r');
@@ -257,7 +257,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
@@ -282,7 +282,7 @@ class FileTest extends NodeTest {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $this->view, '/bar/foo');
$node->fopen('w');
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index d33fb4f68f8..979c7fd6da6 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -59,15 +59,15 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->any())
->method('getDirectoryContent')
->with('/bar/foo')
- ->will($this->returnValue(array(
+ ->willReturn(array(
new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null),
new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null)
- )));
+ ));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$children = $node->getDirectoryListing();
@@ -91,7 +91,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -112,14 +112,14 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
$root->expects($this->once())
->method('get')
->with('/bar/foo/asd')
- ->will($this->returnValue($child));
+ ->willReturn($child);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertTrue($node->nodeExists('asd'));
@@ -136,7 +136,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$root->expects($this->once())
->method('get')
@@ -158,17 +158,17 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('mkdir')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd');
@@ -190,12 +190,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFolder('asd');
@@ -212,17 +212,17 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('touch')
->with('/bar/foo/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$child = new \OC\Files\Node\File($root, $view, '/bar/foo/asd');
@@ -244,12 +244,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFile('asd');
@@ -266,12 +266,12 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$view->expects($this->once())
->method('free_space')
->with('/bar/foo')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$this->assertEquals(100, $node->getFreeSpace());
@@ -288,39 +288,39 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->search('qw');
@@ -340,7 +340,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/** @var \PHPUnit_Framework_MockObject_MockObject|Storage $storage */
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
@@ -349,32 +349,32 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('files'));
+ ->willReturn('files');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
array('fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'),
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$result = $root->search('qw');
$this->assertEquals(1, count($result));
@@ -392,7 +392,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -400,31 +400,31 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue(''));
+ ->willReturn('');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->search('qw');
@@ -443,7 +443,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$storage = $this->createMock(Storage::class);
$storage->method('getId')->willReturn('');
$cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock();
@@ -454,50 +454,50 @@ class FolderTest extends NodeTest {
$mount = $this->createMock(IMountPoint::class);
$mount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($storage));
+ ->willReturn($storage);
$mount->expects($this->once())
->method('getInternalPath')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$subMount->expects($this->once())
->method('getStorage')
- ->will($this->returnValue($subStorage));
+ ->willReturn($subStorage);
$subMount->expects($this->once())
->method('getMountPoint')
- ->will($this->returnValue('/bar/foo/bar/'));
+ ->willReturn('/bar/foo/bar/');
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$subStorage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($subCache));
+ ->willReturn($subCache);
$cache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$subCache->expects($this->once())
->method('search')
->with('%qw%')
- ->will($this->returnValue(array(
+ ->willReturn(array(
array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain')
- )));
+ ));
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($subMount)));
+ ->willReturn(array($subMount));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
@@ -534,34 +534,34 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -588,29 +588,29 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMount')
->with('/bar')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar');
$result = $node->getById(1);
@@ -637,34 +637,34 @@ class FolderTest extends NodeTest {
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([new CachedMountInfo(
+ ->willReturn([new CachedMountInfo(
$this->user,
1,
0,
'/bar/',
1,
''
- )]));
+ )]);
$cache->expects($this->once())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->once())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -691,12 +691,12 @@ class FolderTest extends NodeTest {
$storage->expects($this->exactly(2))
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$this->userMountCache->expects($this->any())
->method('getMountsForFileId')
->with(1)
- ->will($this->returnValue([
+ ->willReturn([
new CachedMountInfo(
$this->user,
1,
@@ -713,26 +713,26 @@ class FolderTest extends NodeTest {
1,
''
)
- ]));
+ ]);
$storage->expects($this->any())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$cache->expects($this->any())
->method('get')
->with(1)
- ->will($this->returnValue($fileInfo));
+ ->willReturn($fileInfo);
$root->expects($this->any())
->method('getMountsIn')
->with('/bar/foo')
- ->will($this->returnValue(array($mount2)));
+ ->willReturn(array($mount2));
$root->expects($this->once())
->method('getMount')
->with('/bar/foo')
- ->will($this->returnValue($mount1));
+ ->willReturn($mount1);
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$result = $node->getById(1);
@@ -767,14 +767,14 @@ class FolderTest extends NodeTest {
$view->expects($this->any())
->method('file_exists')
- ->will($this->returnCallback(function ($path) use ($existingFiles, $folderPath) {
+ ->willReturnCallback(function ($path) use ($existingFiles, $folderPath) {
foreach ($existingFiles as $existing) {
if ($folderPath . '/' . $existing === $path) {
return true;
}
}
return false;
- }));
+ });
$node = new \OC\Files\Node\Folder($root, $view, $folderPath);
$this->assertEquals($expected, $node->getNonExistingName($name));
@@ -802,7 +802,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -866,7 +866,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
@@ -932,7 +932,7 @@ class FolderTest extends NodeTest {
$folderInfo->expects($this->any())
->method('getMountPoint')
- ->will($this->returnValue($mount));
+ ->willReturn($mount);
$cache = $storage->getCache();
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 7c8ddee6b5f..18cc4d80574 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -92,7 +92,7 @@ abstract class NodeTest extends \Test\TestCase {
->getMock();
$storage->expects($this->any())
->method('getId')
- ->will($this->returnValue('home::someuser'));
+ ->willReturn('home::someuser');
return $storage;
}
@@ -103,20 +103,20 @@ abstract class NodeTest extends \Test\TestCase {
public function testDelete() {
$this->root->expects($this->exactly(2))
->method('emit')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -163,17 +163,17 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain'])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain']));
$this->view->expects($this->once())
->method($this->getViewDeleteMethod())
->with('/bar/foo')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue([null, 'foo']));
+ ->willReturn([null, 'foo']);
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->delete();
@@ -186,12 +186,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->delete();
@@ -201,7 +201,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testStat() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = array(
'fileid' => 1,
@@ -214,7 +214,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('stat')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals($stat, $node->stat());
@@ -223,7 +223,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetId() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -235,7 +235,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(1, $node->getId());
@@ -244,7 +244,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetSize() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
@@ -257,7 +257,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(100, $node->getSize());
@@ -266,7 +266,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetEtag() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -278,7 +278,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('qwerty', $node->getEtag());
@@ -287,7 +287,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$stat = $this->getFileInfo(array(
'fileid' => 1,
@@ -299,7 +299,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($stat));
+ ->willReturn($stat);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals(50, $node->getMTime());
@@ -308,7 +308,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetStorage() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -319,7 +319,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -329,7 +329,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('/bar/foo', $node->getPath());
@@ -338,7 +338,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetInternalPath() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
/**
* @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage
*/
@@ -349,7 +349,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array($storage, 'foo')));
+ ->willReturn(array($storage, 'foo'));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
@@ -359,7 +359,7 @@ abstract class NodeTest extends \Test\TestCase {
public function testGetName() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$this->assertEquals('foo', $node->getName());
@@ -368,17 +368,17 @@ abstract class NodeTest extends \Test\TestCase {
public function testTouchSetMTime() {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -420,17 +420,17 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('touch')
->with('/bar/foo', 100)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('resolvePath')
->with('/bar/foo')
- ->will($this->returnValue(array(null, 'foo')));
+ ->willReturn(array(null, 'foo'));
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = $this->createTestNode($root, $this->view, '/bar/foo');
$node->touch(100);
@@ -443,12 +443,12 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ))));
+ ->willReturn($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$node->touch(100);
@@ -466,11 +466,11 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
@@ -478,10 +478,10 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->exactly(2))
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar/asd', $newNode],
['/bar', $parentNode]
- ]));
+ ]);
$target = $node->copy('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -505,16 +505,16 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -548,9 +548,9 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['/bar', $parentNode]
- ]));
+ ]);
$node->copy('/bar/asd');
}
@@ -559,18 +559,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$target = $node->move('/bar/asd');
$this->assertInstanceOf($this->getNodeClass(), $target);
@@ -602,11 +602,11 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method($viewMethod)
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
/**
* @var \OC\Files\Node\File|\PHPUnit_Framework_MockObject_MockObject $node
@@ -617,7 +617,7 @@ abstract class NodeTest extends \Test\TestCase {
$root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]);
$hooksRun = 0;
@@ -665,7 +665,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]));
$this->view->expects($this->never())
->method('rename');
@@ -676,7 +676,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -716,7 +716,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->root->expects($this->once())
->method('get')
->with('/bar')
- ->will($this->returnValue($parentNode));
+ ->willReturn($parentNode);
$node->move('/bar/asd');
}
@@ -728,18 +728,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->move('/bar/asd');
}
@@ -751,18 +751,18 @@ abstract class NodeTest extends \Test\TestCase {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])));
+ ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]));
$node = $this->createTestNode($this->root, $this->view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar');
$this->root->expects($this->any())
->method('get')
- ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]]));
+ ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]);
$node->copy('/bar/asd');
}
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 5067236ec58..6c4189bdec7 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -79,7 +79,7 @@ class RootTest extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'))));
+ ->willReturn($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain')));
$root->mount($storage, '');
$node = $root->get('/bar/foo');
@@ -115,7 +115,7 @@ class RootTest extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$root->mount($storage, '');
$root->get('/bar/foo');
diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
index 0061ca3910e..164541b670c 100644
--- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php
+++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
@@ -82,7 +82,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
->getMock();
$storage->expects($this->any())
->method('free_space')
- ->will($this->returnValue(-2));
+ ->willReturn(-2);
$storage->getScanner()->scan('');
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
@@ -138,7 +138,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
->getMock();
$failStorage->expects($this->any())
->method('fopen')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $failStorage, 'quota' => 1000));
@@ -189,14 +189,14 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
->method('getCache')
- ->will($this->returnValue($cache));
+ ->willReturn($cache);
$storage->expects($this->once())
->method('free_space')
- ->will($this->returnValue(2048));
+ ->willReturn(2048);
$cache->expects($this->once())
->method('get')
->with('files')
- ->will($this->returnValue(new CacheEntry(['size' => 50])));
+ ->willReturn(new CacheEntry(['size' => 50]));
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files'));
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index fd5e8c6ca9d..09333a86144 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -99,10 +99,10 @@ class EncryptionTest extends \Test\TestCase {
$fileMock->expects($this->never())->method('getAccessList');
} else {
$fileMock->expects($this->once())->method('getAccessList')
- ->will($this->returnCallback(function ($sharePath) use ($expectedSharePath) {
+ ->willReturnCallback(function ($sharePath) use ($expectedSharePath) {
$this->assertSame($expectedSharePath, $sharePath);
return array();
- }));
+ });
}
$utilMock = $this->getMockBuilder('\OC\Encryption\Util')
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index 01f11bf39c8..3befe64c825 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -240,14 +240,14 @@ class DetectionTest extends \Test\TestCase {
[$this->equalTo('core'), $this->equalTo('filetypes/my-type.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/my.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/my.png') {
return 'my.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('my-type');
@@ -271,14 +271,14 @@ class DetectionTest extends \Test\TestCase {
[$this->equalTo('core'), $this->equalTo('filetypes/foo.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/file.png')]
)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function($appName, $file) {
if ($file === 'filetypes/file.png') {
return 'file.svg';
}
throw new \RuntimeException();
}
- ));
+ );
$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
$mimeType = $detection->mimeTypeIcon('foo-bar');
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php
index 44422cd97d1..9d82e4ae1e1 100644
--- a/tests/lib/Files/Utils/ScannerTest.php
+++ b/tests/lib/Files/Utils/ScannerTest.php
@@ -117,13 +117,13 @@ class ScannerTest extends \Test\TestCase {
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
+ ->willReturnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) {
if ($user->getUID() === $uid) {
return [$mount];
} else {
return [];
}
- }));
+ });
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);
$cache = $storage->getCache();
@@ -199,9 +199,9 @@ class ScannerTest extends \Test\TestCase {
$sharedStorage->expects($this->any())
->method('instanceOfStorage')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[SharedStorage::class, true],
- ]));
+ ]);
$sharedStorage->expects($this->never())
->method('getScanner');
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 57050059375..5f3116e7b24 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -1169,11 +1169,11 @@ class ViewTest extends \Test\TestCase {
$storage2->expects($this->any())
->method('fopen')
- ->will($this->returnCallback(function ($path, $mode) use ($storage2) {
+ ->willReturnCallback(function ($path, $mode) use ($storage2) {
/** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Storage\Temporary $storage2 */
$source = fopen($storage2->getSourcePath($path), $mode);
return Quota::wrap($source, 9);
- }));
+ });
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
@@ -1220,7 +1220,7 @@ class ViewTest extends \Test\TestCase {
->getMock();
$storage->expects($this->once())
->method('unlink')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$scanner = $storage->getScanner();
$cache = $storage->getCache();
$storage->file_put_contents('foo.txt', 'asd');
@@ -1597,7 +1597,7 @@ class ViewTest extends \Test\TestCase {
$mountProvider = $this->createMock(IMountProvider::class);
$mountProvider->expects($this->any())
->method('getMountsForUser')
- ->will($this->returnValue($mounts));
+ ->willReturn($mounts);
$mountProviderCollection = \OC::$server->getMountProviderCollection();
$mountProviderCollection->registerProvider($mountProvider);
@@ -1617,11 +1617,11 @@ class ViewTest extends \Test\TestCase {
]);
$mount1->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$mount2->expects($this->once())
->method('moveMount')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$view = new View('/' . $this->user . '/files/');
$view->mkdir('sub');
@@ -1846,13 +1846,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $lockedPath, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $lockedPath);
return true;
}
- ));
+ );
$this->assertNull($this->getFileLockType($view, $lockedPath), 'File not locked before operation');
@@ -1890,13 +1890,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1929,13 +1929,13 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('fopen')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, &$lockTypeDuring) {
$lockTypeDuring = $this->getFileLockType($view, $path);
return fopen('php://temp', 'r+');
}
- ));
+ );
$this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost);
@@ -1990,11 +1990,11 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception('Simulated exception');
}
- ));
+ );
$thrown = false;
try {
@@ -2102,7 +2102,7 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'target.txt';
@@ -2113,14 +2113,14 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method($operation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($operation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($operation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2166,11 +2166,11 @@ class ViewTest extends \Test\TestCase {
$storage->expects($this->once())
->method('copy')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () {
throw new \Exception();
}
- ));
+ );
$this->connectMockHooks('copy', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks('copy', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2282,7 +2282,7 @@ class ViewTest extends \Test\TestCase {
$storage2->expects($this->any())
->method('filemtime')
- ->will($this->returnValue(123456789));
+ ->willReturn(123456789);
$sourcePath = 'original.txt';
$targetPath = 'substorage/target.txt';
@@ -2296,14 +2296,14 @@ class ViewTest extends \Test\TestCase {
->method($storageOperation);
$storage2->expects($this->once())
->method($storageOperation)
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
return true;
}
- ));
+ );
$this->connectMockHooks($viewOperation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost);
$this->connectMockHooks($viewOperation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost);
@@ -2343,7 +2343,7 @@ class ViewTest extends \Test\TestCase {
$mount->expects($this->once())
->method('moveMount')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true);
@@ -2354,7 +2354,7 @@ class ViewTest extends \Test\TestCase {
return true;
}
- ));
+ );
$this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost, true);
$this->connectMockHooks('rename', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost, true);
@@ -2408,18 +2408,18 @@ class ViewTest extends \Test\TestCase {
$eventHandler->expects($this->any())
->method('preCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePre) {
$lockTypePre = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
$eventHandler->expects($this->any())
->method('postCallback')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($view, $path, $onMountPoint, &$lockTypePost) {
$lockTypePost = $this->getFileLockType($view, $path, $onMountPoint);
}
- ));
+ );
if ($hookType !== null) {
Util::connectHook(
diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php
index 61e4b39c8f3..554432a2c86 100644
--- a/tests/lib/Group/GroupTest.php
+++ b/tests/lib/Group/GroupTest.php
@@ -56,11 +56,11 @@ class GroupTest extends \Test\TestCase {
$user3 = $this->newUser('user3', $backend);
$userManager->expects($this->any())
->method('get')
- ->will($this->returnValueMap(array(
+ ->willReturnMap(array(
array('user1', $user1),
array('user2', $user2),
array('user3', $user3)
- )));
+ ));
return $userManager;
}
@@ -74,7 +74,7 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user1', 'user2')));
+ ->willReturn(array('user1', 'user2'));
$users = $group->getUsers();
@@ -98,12 +98,12 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user1', 'user2')));
+ ->willReturn(array('user1', 'user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1')
- ->will($this->returnValue(array('user2', 'user3')));
+ ->willReturn(array('user2', 'user3'));
$users = $group->getUsers();
@@ -129,7 +129,7 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
@@ -150,12 +150,12 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend2->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
@@ -173,10 +173,10 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('addToGroup')
@@ -198,10 +198,10 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('addToGroup');
@@ -222,10 +222,10 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('removeFromGroup')
@@ -247,10 +247,10 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('removeFromGroup');
@@ -274,10 +274,10 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->once())
->method('removeFromGroup')
@@ -286,10 +286,10 @@ class GroupTest extends \Test\TestCase {
$backend2->expects($this->once())
->method('inGroup')
->with('user1', 'group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('removeFromGroup')
@@ -308,7 +308,7 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('2');
@@ -330,11 +330,11 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1', '2')
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('2');
@@ -353,7 +353,7 @@ class GroupTest extends \Test\TestCase {
$backend->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 1, 1)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$users = $group->searchUsers('user', 1, 1);
@@ -375,11 +375,11 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 2, 1)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$backend2->expects($this->once())
->method('usersInGroup')
->with('group1', 'user', 2, 1)
- ->will($this->returnValue(array('user1')));
+ ->willReturn(array('user1'));
$users = $group->searchUsers('user', 2, 1);
@@ -400,11 +400,11 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(3));
+ ->willReturn(3);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$users = $group->count('2');
@@ -424,18 +424,18 @@ class GroupTest extends \Test\TestCase {
$backend1->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(3));
+ ->willReturn(3);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('countUsersInGroup')
->with('group1', '2')
- ->will($this->returnValue(4));
+ ->willReturn(4);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$users = $group->count('2');
@@ -453,7 +453,7 @@ class GroupTest extends \Test\TestCase {
->method('countUsersInGroup');
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$users = $group->count('2');
@@ -472,7 +472,7 @@ class GroupTest extends \Test\TestCase {
->with('group1');
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$group->delete();
}
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index d5f8baa3fa1..8385c924edf 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -52,10 +52,10 @@ class ManagerTest extends TestCase {
$mockUser = $this->createMock(IUser::class);
$mockUser->expects($this->any())
->method('getUID')
- ->will($this->returnValue($userId));
+ ->willReturn($userId);
$mockUser->expects($this->any())
->method('getDisplayName')
- ->will($this->returnValue($userId));
+ ->willReturn($userId);
return $mockUser;
}
@@ -91,9 +91,9 @@ class ManagerTest extends TestCase {
->getMock();
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function($actions) use ($implementedActions) {
+ ->willReturnCallback(function($actions) use ($implementedActions) {
return (bool)($actions & $implementedActions);
- }));
+ });
return $backend;
}
@@ -105,7 +105,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -129,7 +129,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -157,7 +157,7 @@ class ManagerTest extends TestCase {
$backend1->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -166,7 +166,7 @@ class ManagerTest extends TestCase {
$backend2->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -184,15 +184,15 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnCallback(function () use (&$backendGroupCreated) {
+ ->willReturnCallback(function () use (&$backendGroupCreated) {
return $backendGroupCreated;
- }));
+ });
$backend->expects($this->once())
->method('createGroup')
- ->will($this->returnCallback(function () use (&$backendGroupCreated) {
+ ->willReturnCallback(function () use (&$backendGroupCreated) {
$backendGroupCreated = true;
return true;
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -236,7 +236,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('createGroup');
@@ -255,11 +255,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -278,10 +278,10 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -290,10 +290,10 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(array('group12', 'group1')));
+ ->willReturn(array('group12', 'group1'));
$backend2->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -315,10 +315,10 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -327,10 +327,10 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('getGroups')
->with('1', 2, 1)
- ->will($this->returnValue(array('group12')));
+ ->willReturn(array('group12'));
$backend2->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -350,11 +350,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getGroups')
->with('1')
- ->will($this->returnValue(['group1']));
+ ->willReturn(['group1']);
$backend->expects($this->once())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @var \OC\User\Manager $userManager */
$userManager = $this->createMock(Manager::class);
@@ -374,11 +374,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -421,11 +421,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -448,10 +448,10 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'admin', 'group2')));
+ ->willReturn(array('group1', 'admin', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -467,10 +467,10 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'admin', 'group2')));
+ ->willReturn(array('group1', 'admin', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -486,10 +486,10 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$backend->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -505,10 +505,10 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1')));
+ ->willReturn(array('group1'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2
@@ -517,10 +517,10 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$backend1->expects($this->any())
->method('groupExists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend1);
@@ -542,11 +542,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid, $gid) {
+ ->willReturnCallback(function($uid, $gid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -555,22 +555,22 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 : return ['user3' => $this->getTestUser('user3'),
'user33' => $this->getTestUser('user33')];
case 2 : return [];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -579,7 +579,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -600,11 +600,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid, $gid) {
+ ->willReturnCallback(function($uid, $gid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -614,22 +614,22 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 : return ['user3' => $this->getTestUser('user3'),
'user33' => $this->getTestUser('user33')];
case 2 : return ['user333' => $this->getTestUser('user333')];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -639,7 +639,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -661,11 +661,11 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('inGroup')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return false;
case 'user2' : return true;
@@ -675,12 +675,12 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$this->userManager->expects($this->any())
->method('searchDisplayName')
->with('user3')
- ->will($this->returnCallback(function($search, $limit, $offset) {
+ ->willReturnCallback(function($search, $limit, $offset) {
switch($offset) {
case 0 :
return [
@@ -690,10 +690,10 @@ class ManagerTest extends TestCase {
];
}
return null;
- }));
+ });
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -703,7 +703,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -725,16 +725,16 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', -1, 0)
- ->will($this->returnValue(array('user2', 'user33')));
+ ->willReturn(array('user2', 'user33'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -743,7 +743,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -764,16 +764,16 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', 1, 0)
- ->will($this->returnValue(array('user2')));
+ ->willReturn(array('user2'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -782,7 +782,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -803,16 +803,16 @@ class ManagerTest extends TestCase {
$backend->expects($this->exactly(1))
->method('groupExists')
->with('testgroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('usersInGroup')
->with('testgroup', '', 1, 1)
- ->will($this->returnValue(array('user33')));
+ ->willReturn(array('user33'));
$this->userManager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch($uid) {
case 'user1' : return $this->getTestUser('user1');
case 'user2' : return $this->getTestUser('user2');
@@ -821,7 +821,7 @@ class ManagerTest extends TestCase {
default:
return null;
}
- }));
+ });
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -843,13 +843,13 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnCallback(function () use (&$expectedGroups) {
+ ->willReturnCallback(function () use (&$expectedGroups) {
return $expectedGroups;
- }));
+ });
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -880,19 +880,19 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnCallback(function () use (&$expectedGroups) {
+ ->willReturnCallback(function () use (&$expectedGroups) {
return $expectedGroups;
- }));
+ });
$backend->expects($this->any())
->method('groupExists')
->with('group1')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('inGroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('removeFromGroup')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -922,7 +922,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('getUserGroups')
->with('user1')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
@@ -945,10 +945,10 @@ class ManagerTest extends TestCase {
);
$backend->expects($this->any())
->method('getGroupDetails')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['group1', ['gid' => 'group1', 'displayName' => 'Group One']],
['group2', ['gid' => 'group2']],
- ]));
+ ]);
$manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger);
$manager->addBackend($backend);
diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php
index 4332a6f036f..ebd9cd79f23 100644
--- a/tests/lib/Group/MetaDataTest.php
+++ b/tests/lib/Group/MetaDataTest.php
@@ -83,7 +83,7 @@ class MetaDataTest extends \Test\TestCase {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get();
@@ -103,7 +103,7 @@ class MetaDataTest extends \Test\TestCase {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get();
@@ -121,7 +121,7 @@ class MetaDataTest extends \Test\TestCase {
$this->groupManager->expects($this->once())
->method('search')
->with('')
- ->will($this->returnValue($groups));
+ ->willReturn($groups);
//two calls, if caching fails call counts for group and groupmanager
//are exceeded
@@ -137,7 +137,7 @@ class MetaDataTest extends \Test\TestCase {
->expects($this->once())
->method('search')
->with('Foo')
- ->will($this->returnValue(['DummyValue']));
+ ->willReturn(['DummyValue']);
$expected = ['DummyValue'];
$this->assertSame($expected, $this->invokePrivate($this->groupMetadata, 'getGroups', ['Foo']));
diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php
index 7b2fb665733..29250109d02 100644
--- a/tests/lib/HelperStorageTest.php
+++ b/tests/lib/HelperStorageTest.php
@@ -71,7 +71,7 @@ class HelperStorageTest extends \Test\TestCase {
$this->storageMock->expects($this->once())
->method('free_space')
- ->will($this->returnValue(12));
+ ->willReturn(12);
return $this->storageMock;
}
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 586a42ff547..22b026eaae5 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -62,13 +62,13 @@ class CheckerTest extends TestCase {
$this->mimeTypeDetector = $this->createMock(\OC\Files\Type\Detection::class);
$this->config->method('getAppValue')
- ->will($this->returnArgument(2));
+ ->willReturnArgument(2);
$this->cacheFactory
->expects($this->any())
->method('createDistributed')
->with('oc.integritycheck.checker')
- ->will($this->returnValue(new NullCache()));
+ ->willReturn(new NullCache());
$this->checker = new Checker(
$this->environmentHelper,
@@ -161,12 +161,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -181,18 +181,18 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -207,14 +207,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@@ -223,18 +223,18 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -249,14 +249,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -271,18 +271,18 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -297,14 +297,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
@@ -335,12 +335,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->never())
@@ -360,14 +360,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
@@ -398,18 +398,18 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -422,14 +422,14 @@ class CheckerTest extends TestCase {
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json')
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -444,18 +444,18 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->once())
->method('getAppPath')
->with('SomeApp')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -468,14 +468,14 @@ class CheckerTest extends TestCase {
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json')
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@@ -540,7 +540,7 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -575,7 +575,7 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -640,7 +640,7 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -667,12 +667,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -687,17 +687,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -712,14 +712,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -728,17 +728,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
$signatureDataFile = '{
"hashes": {
".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
@@ -753,14 +753,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -769,12 +769,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->mimeTypeDetector
->expects($this->once())
@@ -994,7 +994,7 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified');
$signatureDataFile = '{
"hashes": {
"mimetypelist.js": "dc48de7ad4baa030c5e563350c9a80b274bad783f6f5adbf1595ecef6c6a32e52890a24cb26cddb0aa20193ba52c001150c68d8bfb567f0aed566f4029a190a3"
@@ -1008,14 +1008,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -1025,17 +1025,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1050,14 +1050,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@@ -1066,17 +1066,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -1091,14 +1091,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1113,17 +1113,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1138,14 +1138,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'INVALID_HASH' => [
@@ -1175,17 +1175,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1200,14 +1200,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1222,17 +1222,17 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
- ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'));
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1247,14 +1247,14 @@ class CheckerTest extends TestCase {
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
- ->will($this->returnValue($signatureDataFile));
+ ->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
- ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')));
+ ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
$expected = [
'EXCEPTION' => [
@@ -1289,17 +1289,17 @@ class CheckerTest extends TestCase {
$this->appLocator
->expects($this->at(0))
->method('getAllApps')
- ->will($this->returnValue([
+ ->willReturn([
'files',
'calendar',
'contacts',
'dav',
- ]));
+ ]);
$this->appManager
->expects($this->at(0))
->method('isShipped')
->with('files')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(1))
->method('verifyAppSignature')
@@ -1308,17 +1308,17 @@ class CheckerTest extends TestCase {
->expects($this->at(1))
->method('isShipped')
->with('calendar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->at(1))
->method('getAppPath')
->with('calendar')
- ->will($this->returnValue('/apps/calendar'));
+ ->willReturn('/apps/calendar');
$this->fileAccessHelper
->expects($this->at(0))
->method('file_exists')
->with('/apps/calendar/appinfo/signature.json')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(2))
->method('verifyAppSignature')
@@ -1327,22 +1327,22 @@ class CheckerTest extends TestCase {
->expects($this->at(2))
->method('isShipped')
->with('contacts')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appLocator
->expects($this->at(2))
->method('getAppPath')
->with('contacts')
- ->will($this->returnValue('/apps/contacts'));
+ ->willReturn('/apps/contacts');
$this->fileAccessHelper
->expects($this->at(1))
->method('file_exists')
->with('/apps/contacts/appinfo/signature.json')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isShipped')
->with('dav')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->checker
->expects($this->at(3))
->method('verifyAppSignature')
@@ -1359,12 +1359,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue('stable'));
+ ->willReturn('stable');
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = [];
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
@@ -1389,12 +1389,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue($channel));
+ ->willReturn($channel);
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertSame($isCodeSigningEnforced, $this->checker->isCodeCheckEnforced());
}
@@ -1407,12 +1407,12 @@ class CheckerTest extends TestCase {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
- ->will($this->returnValue($channel));
+ ->willReturn($channel);
$this->config
->expects($this->any())
->method('getSystemValue')
->with('integrity.check.disabled', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertFalse(self::invokePrivate($this->checker, 'isCodeCheckEnforced'));
}
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index c75bfba5b99..4d35aeabc91 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -510,7 +510,7 @@ class FactoryTest extends TestCase {
$this->config->expects($this->any())
->method('getSystemValue')
- ->will($this->returnCallback(function($var, $default) use ($defaultLang) {
+ ->willReturnCallback(function($var, $default) use ($defaultLang) {
if ($var === 'installed') {
return true;
} else if ($var === 'default_language') {
@@ -518,7 +518,7 @@ class FactoryTest extends TestCase {
} else {
return $default;
}
- }));
+ });
if ($loggedIn) {
$user = $this->getMockBuilder(IUser::class)
@@ -549,14 +549,14 @@ class FactoryTest extends TestCase {
$factory = $this->getFactory(['languageExists', 'findAvailableLanguages', 'respectDefaultLanguage']);
$factory->expects($this->any())
->method('languageExists')
- ->will($this->returnCallback(function ($app, $lang) use ($availableLang) {
+ ->willReturnCallback(function ($app, $lang) use ($availableLang) {
return in_array($lang, $availableLang);
- }));
+ });
$factory->expects($this->any())
->method('findAvailableLanguages')
- ->will($this->returnCallback(function ($app) use ($availableLang) {
+ ->willReturnCallback(function ($app) use ($availableLang) {
return $availableLang;
- }));
+ });
$factory->expects($this->any())
->method('respectDefaultLanguage')->willReturnCallback(function($app, $lang) {
return $lang;
diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php
index 21d5dbc8bab..e023819a088 100644
--- a/tests/lib/LegacyHelperTest.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -112,56 +112,56 @@ class LegacyHelperTest extends \Test\TestCase {
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename.ext exists
+ ->willReturn(true); // filename.ext exists
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename.ext exists
+ ->willReturn(true); // filename.ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (1).ext exists
+ ->willReturn(true); // filename (1).ext exists
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (2).ext exists
+ ->willReturn(true); // filename (2).ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename (3).ext exists
+ ->willReturn(true); // filename (3).ext exists
$this->assertEquals('dir/filename (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1).ext exists
+ ->willReturn(true); // filename(1).ext exists
$this->assertEquals('dir/filename(2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (1).ext exists
+ ->willReturn(true); // filename(1) (1).ext exists
$this->assertEquals('dir/filename(1) (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (1).ext exists
+ ->willReturn(true); // filename(1) (1).ext exists
$viewMock->expects($this->at(1))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (2).ext exists
+ ->willReturn(true); // filename(1) (2).ext exists
$this->assertEquals('dir/filename(1) (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock->expects($this->at(0))
->method('file_exists')
- ->will($this->returnValue(true)); // filename(1) (2) (3).ext exists
+ ->willReturn(true); // filename(1) (2) (3).ext exists
$this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock));
}
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php
index 73a7b6c3f83..ac58538284c 100644
--- a/tests/lib/Lock/DBLockingProviderTest.php
+++ b/tests/lib/Lock/DBLockingProviderTest.php
@@ -54,9 +54,9 @@ class DBLockingProviderTest extends LockingProvider {
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnCallback(function () {
+ ->willReturnCallback(function () {
return $this->currentTime;
- }));
+ });
parent::setUp();
}
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 1d19929fe00..bc451f833f2 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -81,10 +81,10 @@ class MailerTest extends TestCase {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
- ]));
+ ]);
$path = \OC_Helper::findBinaryPath('sendmail');
if ($path === null) {
@@ -104,10 +104,10 @@ class MailerTest extends TestCase {
$this->config
->expects($this->exactly(2))
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'qmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
- ]));
+ ]);
$this->assertEquals(new \Swift_SendmailTransport('/var/qmail/bin/sendmail' . $binaryParam), self::invokePrivate($this->mailer, 'getSendMailInstance'));
}
@@ -121,10 +121,10 @@ class MailerTest extends TestCase {
public function testGetInstanceSendmail() {
$this->config
->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', 'smtp'],
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertInstanceOf(\Swift_Mailer::class, $mailer);
@@ -151,7 +151,7 @@ class MailerTest extends TestCase {
->expects($this->any())
->method('getSystemValue')
->with('mail_send_plaintext_only', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage());
}
@@ -163,7 +163,7 @@ class MailerTest extends TestCase {
->disableOriginalConstructor()->getMock();
$message->expects($this->once())
->method('getSwiftMessage')
- ->will($this->returnValue(new \Swift_Message()));
+ ->willReturn(new \Swift_Message());
$this->mailer->send($message);
}
@@ -199,10 +199,10 @@ class MailerTest extends TestCase {
public function testStreamingOptions() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], ['foo' => 1]]
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertEquals(1, count($mailer->getTransport()->getStreamOptions()));
$this->assertTrue(isset($mailer->getTransport()->getStreamOptions()['foo']));
@@ -211,10 +211,10 @@ class MailerTest extends TestCase {
public function testStreamingOptionsWrongType() {
$this->config->method('getSystemValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], 'bar']
- ]));
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
$this->assertEquals(0, count($mailer->getTransport()->getStreamOptions()));
}
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index ab62cfcfdcb..14c24345069 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -80,7 +80,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getFrom')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getFrom());
}
@@ -117,7 +117,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getTo')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getTo());
}
@@ -137,7 +137,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getCc')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getCc());
}
@@ -157,7 +157,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getBcc')
- ->will($this->returnValue($swiftresult));
+ ->willReturn($swiftresult);
$this->assertSame($return, $this->message->getBcc());
}
@@ -175,7 +175,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getSubject')
- ->will($this->returnValue('Fancy Subject'));
+ ->willReturn('Fancy Subject');
$this->assertSame('Fancy Subject', $this->message->getSubject());
}
@@ -193,7 +193,7 @@ class MessageTest extends TestCase {
$this->swiftMessage
->expects($this->once())
->method('getBody')
- ->will($this->returnValue('Fancy Body'));
+ ->willReturn('Fancy Body');
$this->assertSame('Fancy Body', $this->message->getPlainBody());
}
diff --git a/tests/lib/Memcache/CasTraitTest.php b/tests/lib/Memcache/CasTraitTest.php
index 2f0ef939aa7..61972153886 100644
--- a/tests/lib/Memcache/CasTraitTest.php
+++ b/tests/lib/Memcache/CasTraitTest.php
@@ -33,27 +33,27 @@ class CasTraitTest extends TestCase {
$mock->expects($this->any())
->method('set')
- ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) {
+ ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) {
return $sourceCache->set($key, $value, $ttl);
- }));
+ });
$mock->expects($this->any())
->method('get')
- ->will($this->returnCallback(function ($key) use ($sourceCache) {
+ ->willReturnCallback(function ($key) use ($sourceCache) {
return $sourceCache->get($key);
- }));
+ });
$mock->expects($this->any())
->method('add')
- ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) {
+ ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) {
return $sourceCache->add($key, $value, $ttl);
- }));
+ });
$mock->expects($this->any())
->method('remove')
- ->will($this->returnCallback(function ($key) use ($sourceCache) {
+ ->willReturnCallback(function ($key) use ($sourceCache) {
return $sourceCache->remove($key);
- }));
+ });
return $mock;
}
diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php
index 7ee802e54fb..3a78793f91d 100644
--- a/tests/lib/OCS/ProviderTest.php
+++ b/tests/lib/OCS/ProviderTest.php
@@ -44,22 +44,22 @@ class ProviderTest extends \Test\TestCase {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -85,22 +85,22 @@ class ProviderTest extends \Test\TestCase {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -139,22 +139,22 @@ class ProviderTest extends \Test\TestCase {
->expects($this->at(0))
->method('isEnabledForUser')
->with('files_sharing')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(1))
->method('isEnabledForUser')
->with('federation')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->appManager
->expects($this->at(2))
->method('isEnabledForUser')
->with('activity')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isEnabledForUser')
->with('provisioning_api')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
@@ -187,7 +187,7 @@ class ProviderTest extends \Test\TestCase {
$this->appManager
->expects($this->any())
->method('isEnabledForUser')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index cfb78a05da5..f5a3f9a1bf0 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -147,9 +147,9 @@ class GeneratorTest extends \Test\TestCase {
->willReturn($previewFolder);
$this->config->method('getSystemValue')
- ->will($this->returnCallback(function($key, $defult) {
+ ->willReturnCallback(function($key, $defult) {
return $defult;
- }));
+ });
$invalidProvider = $this->createMock(IProviderV2::class);
$invalidProvider->method('isAvailable')
@@ -169,7 +169,7 @@ class GeneratorTest extends \Test\TestCase {
]);
$this->helper->method('getProvider')
- ->will($this->returnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) {
+ ->willReturnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) {
if ($provider === 'wrongProvider') {
$this->fail('Wrongprovider should not be constructed!');
} else if ($provider === 'brokenProvider') {
@@ -182,7 +182,7 @@ class GeneratorTest extends \Test\TestCase {
return $unavailableProvider;
}
$this->fail('Unexpected provider requested');
- }));
+ });
$image = $this->createMock(IImage::class);
$image->method('width')->willReturn(2048);
@@ -191,13 +191,13 @@ class GeneratorTest extends \Test\TestCase {
$image->method('dataMimeType')->willReturn('image/png');
$this->helper->method('getThumbnail')
- ->will($this->returnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) {
+ ->willReturnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) {
if ($provider === $validProvider) {
return $image;
} else {
return false;
}
- }));
+ });
$image->method('data')
->willReturn('my data');
@@ -211,14 +211,14 @@ class GeneratorTest extends \Test\TestCase {
$previewFolder->method('getDirectoryListing')
->willReturn([]);
$previewFolder->method('newFile')
- ->will($this->returnCallback(function($filename) use ($maxPreview, $previewFile) {
+ ->willReturnCallback(function($filename) use ($maxPreview, $previewFile) {
if ($filename === '2048-2048-max.png') {
return $maxPreview;
} else if ($filename === '256-256.png') {
return $previewFile;
}
$this->fail('Unexpected file');
- }));
+ });
$maxPreview->expects($this->once())
->method('putContent')
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index 1baaf89e0a0..ed25a81ca1f 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -40,7 +40,7 @@ class RepairInvalidSharesTest extends TestCase {
$config->expects($this->any())
->method('getSystemValue')
->with('version')
- ->will($this->returnValue('12.0.0.0'));
+ ->willReturn('12.0.0.0');
$this->connection = \OC::$server->getDatabaseConnection();
$this->deleteAllShares();
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index 013e170cc9d..d7525a09b18 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -46,7 +46,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
$config->expects($this->any())
->method('getSystemValue')
->with('version')
- ->will($this->returnValue('11.0.0.0'));
+ ->willReturn('11.0.0.0');
$this->storage = new \OC\Files\Storage\Temporary([]);
diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php
index 433a161e8fa..bc1671d9178 100644
--- a/tests/lib/RepairStepTest.php
+++ b/tests/lib/RepairStepTest.php
@@ -93,7 +93,7 @@ class RepairTest extends TestCase {
->will($this->throwException(new \Exception()));
$mock->expects($this->any())
->method('getName')
- ->will($this->returnValue('Exception Test'));
+ ->willReturn('Exception Test');
$this->repair->addStep($mock);
$this->repair->addStep(new TestRepairStep(false));
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index 048540fb5a5..5e0db3bf24c 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -185,7 +185,7 @@ class ThrottlerTest extends TestCase {
->willReturn($enabled);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) use ($whitelists) {
+ ->willReturnCallback(function($app, $key, $default) use ($whitelists) {
if ($app !== 'bruteForce') {
return $default;
}
@@ -193,7 +193,7 @@ class ThrottlerTest extends TestCase {
return $whitelists[$key];
}
return $default;
- }));
+ });
$this->assertSame(
($enabled === false) ? true : $isWhiteListed,
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index 0b93c704b5c..5ebcac7756a 100644
--- a/tests/lib/Security/CredentialsManagerTest.php
+++ b/tests/lib/Security/CredentialsManagerTest.php
@@ -54,7 +54,7 @@ class CredentialsManagerTest extends \Test\TestCase {
$result->expects($this->any())
->method('fetch')
- ->will($this->returnValue($row));
+ ->willReturn($row);
return $result;
}
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index f3ee14dead1..2796dead0e2 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -34,11 +34,11 @@ class TrustedDomainHelperTest extends \Test\TestCase {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->config->expects($this->at(1))
->method('getSystemValue')
->with('trusted_domains')
- ->will($this->returnValue($trustedDomains));
+ ->willReturn($trustedDomains);
$trustedDomainHelper = new TrustedDomainHelper($this->config);
$this->assertEquals($result, $trustedDomainHelper->isTrustedDomain($testDomain));
@@ -122,7 +122,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with('overwritehost')
- ->will($this->returnValue('myproxyhost'));
+ ->willReturn('myproxyhost');
$trustedDomainHelper = new TrustedDomainHelper($this->config);
$this->assertTrue($trustedDomainHelper->isTrustedDomain('myproxyhost'));
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index bce547c9a29..f83bf99f315 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -96,7 +96,7 @@ class ManagerTest extends TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->assertEquals([], $this->manager->getPersonalSections());
}
@@ -195,7 +195,7 @@ class ManagerTest extends TestCase {
$this->l10n
->expects($this->any())
->method('t')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index 7ab3eb78539..0890b70dfcd 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -56,17 +56,17 @@ class SetupTest extends \Test\TestCase {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'oci']
- ));
+ );
$this->setupClass
->expects($this->once())
->method('is_callable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue(['sqlite']));
+ ->willReturn(['sqlite']);
$result = $this->setupClass->getSupportedDatabases();
$expectedResult = [
'sqlite' => 'SQLite'
@@ -79,17 +79,17 @@ class SetupTest extends \Test\TestCase {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'oci', 'pgsql']
- ));
+ );
$this->setupClass
->expects($this->any())
->method('is_callable')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$result = $this->setupClass->getSupportedDatabases();
$this->assertSame([], $result);
@@ -99,17 +99,17 @@ class SetupTest extends \Test\TestCase {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue(
+ ->willReturn(
['sqlite', 'mysql', 'pgsql', 'oci']
- ));
+ );
$this->setupClass
->expects($this->any())
->method('is_callable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
- ->will($this->returnValue(['sqlite', 'mysql', 'pgsql']));
+ ->willReturn(['sqlite', 'mysql', 'pgsql']);
$result = $this->setupClass->getSupportedDatabases();
$expectedResult = [
'sqlite' => 'SQLite',
@@ -128,7 +128,7 @@ class SetupTest extends \Test\TestCase {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue('NotAnArray'));
+ ->willReturn('NotAnArray');
$this->setupClass->getSupportedDatabases();
}
@@ -143,7 +143,7 @@ class SetupTest extends \Test\TestCase {
$this->config
->expects($this->once())
->method('getValue')
- ->will($this->returnValue($url));
+ ->willReturn($url);
\OC::$CLI = true;
try {
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index ff3cafbdf7c..396f0cbad84 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -179,9 +179,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -301,9 +301,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -334,13 +334,13 @@ class DefaultShareProviderTest extends \Test\TestCase {
$node = $this->createMock(Folder::class);
$node->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user0')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user0')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$node]);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$this->groupManager->method('get')->with('group0')->willReturn($group0);
$share = $this->provider->getShareById($id, 'user1');
@@ -384,9 +384,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $shareOwnerFolder],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -599,9 +599,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['shareOwner', $ownerFolder],
- ]));
+ ]);
$share = $this->createMock(IShare::class);
$share->method('getId')->willReturn($id);
@@ -647,10 +647,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -703,10 +703,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -760,10 +760,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['sharedBy', $userFolder],
['shareOwner', $ownerFolder],
- ]));
+ ]);
$userFolder->method('getById')
->with(100)
@@ -822,7 +822,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
$share = $this->provider->getShareByToken('secrettoken');
@@ -913,7 +913,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
$share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_USER, null, 1 , 0);
@@ -990,7 +990,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->groupManager->method('get')->with('sharedWith')->willReturn($group);
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
$share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_GROUP, null, 20 , 1);
@@ -1081,7 +1081,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->groupManager->method('get')->with('sharedWith')->willReturn($group);
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId)->willReturn([$file]);
$share = $this->provider->getSharedWith('user', \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0);
@@ -1124,7 +1124,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn($fileId2);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId2)->willReturn([$file]);
$share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_USER, $file, -1, 0);
@@ -1169,7 +1169,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$node = $this->createMock(Folder::class);
$node->method('getId')->willReturn($fileId2);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with($fileId2)->willReturn([$node]);
$share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0);
@@ -1220,7 +1220,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]);
$groups = [];
@@ -1285,7 +1285,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals(1, $qb->execute());
$file = $this->createMock(File::class);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
$share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0);
@@ -1335,7 +1335,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
$share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0);
@@ -1385,7 +1385,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf();
$this->rootFolder->method('getById')->with(42)->willReturn([$file]);
$shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0);
@@ -1431,10 +1431,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1444,7 +1444,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1502,10 +1502,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1515,7 +1515,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1562,10 +1562,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group');
@@ -1575,7 +1575,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1607,17 +1607,17 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1->method('getUID')->willReturn('user1');
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$this->groupManager->method('get')->with('group')->willReturn(null);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1647,15 +1647,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('user2');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1701,15 +1701,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('user2');
$user3 = $this->createMock(IUser::class);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
['user2', $user2],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1739,14 +1739,14 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1 = $this->createMock(IUser::class);
$user1->method('getUID')->willReturn('user1');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user1', $user1],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(1);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->with(1)->willReturn([$file]);
$share = $this->provider->getShareById($id);
@@ -1766,10 +1766,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1782,10 +1782,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1823,10 +1823,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1839,10 +1839,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1889,10 +1889,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1905,10 +1905,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -1946,10 +1946,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$groups = [];
@@ -1959,10 +1959,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$groups['group'.$i] = $group;
}
- $this->groupManager->method('get')->will(
- $this->returnCallback(function($groupId) use ($groups) {
+ $this->groupManager->method('get')->willReturnCallback(
+ function($groupId) use ($groups) {
return $groups[$groupId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -1975,10 +1975,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -2024,10 +2024,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$users['user'.$i] = $user;
}
- $this->userManager->method('get')->will(
- $this->returnCallback(function($userId) use ($users) {
+ $this->userManager->method('get')->willReturnCallback(
+ function($userId) use ($users) {
return $users[$userId];
- })
+ }
);
$groups = [];
@@ -2037,10 +2037,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$groups['group'.$i] = $group;
}
- $this->groupManager->method('get')->will(
- $this->returnCallback(function($groupId) use ($groups) {
+ $this->groupManager->method('get')->willReturnCallback(
+ function($groupId) use ($groups) {
return $groups[$groupId];
- })
+ }
);
$file1 = $this->createMock(File::class);
@@ -2053,10 +2053,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$folder2 = $this->createMock(Folder::class);
$folder2->method('getById')->with(43)->willReturn([$file2]);
- $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([
+ $this->rootFolder->method('getUserFolder')->willReturnMap([
['user2', $folder1],
['user5', $folder2],
- ]));
+ ]);
$share = $this->provider->getShareById($id);
@@ -2118,15 +2118,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$user1->method('getUID')->willReturn('user1');
$user1->method('getDisplayName')->willReturn('user1');
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$file = $this->createMock(File::class);
$file->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$file]);
$share = $this->provider->getShareById($id, null);
@@ -2153,15 +2153,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->groupManager->method('get')->with('group0')->willReturn($group0);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['user0', $user0],
['user1', $user1],
- ]));
+ ]);
$folder = $this->createMock(Folder::class);
$folder->method('getId')->willReturn(42);
- $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf();
$this->rootFolder->method('getById')->willReturn([$folder]);
$share = $this->provider->getShareById($id, 'user0');
@@ -2845,7 +2845,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->rootFolder
->method('getUserFolder')
- ->will($this->returnValueMap(
+ ->willReturnMap(
[
['shareOwner1', $shareOwner1Folder],
['shareOwner2', $shareOwner2Folder],
@@ -2853,7 +2853,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
['shareOwner4', $shareOwner4Folder],
['shareOwner5', $shareOwner5Folder],
]
- ));
+ );
$shares = iterator_to_array($this->provider->getAllShares());
$this->assertEquals(4, count($shares));
diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php
index 14fe32323c1..2b062e592ba 100644
--- a/tests/lib/Share20/LegacyHooksTest.php
+++ b/tests/lib/Share20/LegacyHooksTest.php
@@ -281,10 +281,10 @@ class LegacyHooksTest extends TestCase {
->expects($this->exactly(1))
->method('preShare')
->with($expected)
- ->will($this->returnCallback(function ($data) {
+ ->willReturnCallback(function ($data) {
$data['run'] = false;
$data['error'] = 'I error';
- }));
+ });
$event = new GenericEvent($share);
$this->eventDispatcher->dispatch('OCP\Share::preShare', $event);
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 314038fe13b..e46e019c6ed 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -123,9 +123,9 @@ class ManagerTest extends \Test\TestCase {
$this->l10nFactory = $this->createMock(IFactory::class);
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
+ ->willReturnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
- }));
+ });
$this->factory = new DummyFactory(\OC::$server);
@@ -334,11 +334,11 @@ class ManagerTest extends \Test\TestCase {
$this->defaultProvider
->method('getChildren')
- ->will($this->returnValueMap([
+ ->willReturnMap([
[$share1, [$share2]],
[$share2, [$share3]],
[$share3, []],
- ]));
+ ]);
$this->defaultProvider
->method('delete')
@@ -423,12 +423,12 @@ class ManagerTest extends \Test\TestCase {
$this->defaultProvider
->expects($this->exactly(4))
->method('getChildren')
- ->will($this->returnCallback(function($_share) use ($share, $shares) {
+ ->willReturnCallback(function($_share) use ($share, $shares) {
if ($_share === $share) {
return $shares;
}
return [];
- }));
+ });
$this->defaultProvider
->expects($this->exactly(3))
@@ -483,26 +483,26 @@ class ManagerTest extends \Test\TestCase {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Passwords are enforced for link shares');
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'verifyPassword', [null]);
}
public function testVerifyPasswordNull() {
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$result = self::invokePrivate($this->manager, 'verifyPassword', [null]);
$this->assertNull($result);
}
public function testVerifyPasswordHook() {
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$this->eventDispatcher->expects($this->once())->method('dispatch')
->willReturnCallback(function(Event $event) {
@@ -521,9 +521,9 @@ class ManagerTest extends \Test\TestCase {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('password not accepted');
- $this->config->method('getAppValue')->will($this->returnValueMap([
+ $this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password', 'no', 'no'],
- ]));
+ ]);
$this->eventDispatcher->expects($this->once())->method('dispatch')
->willReturnCallback(function(Event $event) {
@@ -697,14 +697,14 @@ class ManagerTest extends \Test\TestCase {
public function testGeneralChecks($share, $exceptionMessage, $exception) {
$thrown = null;
- $this->userManager->method('userExists')->will($this->returnValueMap([
+ $this->userManager->method('userExists')->willReturnMap([
['user0', true],
['user1', true],
- ]));
+ ]);
- $this->groupManager->method('groupExists')->will($this->returnValueMap([
+ $this->groupManager->method('groupExists')->willReturnMap([
['group0', true],
- ]));
+ ]);
$userFolder = $this->createMock(Folder::class);
$userFolder->method('getPath')->willReturn('myrootfolder');
@@ -735,10 +735,10 @@ class ManagerTest extends \Test\TestCase {
$thrown = null;
- $this->userManager->method('userExists')->will($this->returnValueMap([
+ $this->userManager->method('userExists')->willReturnMap([
['user0', true],
['user1', true],
- ]));
+ ]);
$userFolder = $this->createMock(Folder::class);
$userFolder->method('isSubNode')->with($userFolder)->willReturn(false);
@@ -779,10 +779,10 @@ class ManagerTest extends \Test\TestCase {
$share->setProviderId('foo')->setId('bar');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
@@ -792,9 +792,9 @@ class ManagerTest extends \Test\TestCase {
$share->setProviderId('foo')->setId('bar');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -805,11 +805,11 @@ class ManagerTest extends \Test\TestCase {
$share = $this->manager->newShare();
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
['core', 'shareapi_default_expire_date', 'no', 'yes'],
- ]));
+ ]);
$expected = new \DateTime();
$expected->setTime(0,0,0);
@@ -830,10 +830,10 @@ class ManagerTest extends \Test\TestCase {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
try {
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -858,10 +858,10 @@ class ManagerTest extends \Test\TestCase {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enforce_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
@@ -921,10 +921,10 @@ class ManagerTest extends \Test\TestCase {
$share->setExpirationDate($future);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
- ]));
+ ]);
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
@@ -946,9 +946,9 @@ class ManagerTest extends \Test\TestCase {
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
- $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) {
+ $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
$data['expirationDate']->sub(new \DateInterval('P2D'));
- }));
+ });
$share = $this->manager->newShare();
$share->setExpirationDate($nextWeek);
@@ -973,10 +973,10 @@ class ManagerTest extends \Test\TestCase {
$hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener');
- $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) {
+ $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
$data['accepted'] = false;
$data['message'] = 'Invalid date!';
- }));
+ });
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
@@ -987,10 +987,10 @@ class ManagerTest extends \Test\TestCase {
$share->setId('42')->setProviderId('foo');
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '6'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
@@ -1010,23 +1010,23 @@ class ManagerTest extends \Test\TestCase {
$this->groupManager
->method('getUserGroupIds')
- ->will(
- $this->returnValueMap([
+ ->willReturnMap(
+ [
[$sharedBy, ['group1']],
[$sharedWith, ['group2']],
- ])
+ ]
);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['sharedBy', $sharedBy],
['sharedWith', $sharedWith],
- ]));
+ ]);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'userCreateChecks', [$share]);
}
@@ -1043,23 +1043,23 @@ class ManagerTest extends \Test\TestCase {
$this->groupManager
->method('getUserGroupIds')
- ->will(
- $this->returnValueMap([
+ ->willReturnMap(
+ [
[$sharedBy, ['group1', 'group3']],
[$sharedWith, ['group2', 'group3']],
- ])
+ ]
);
- $this->userManager->method('get')->will($this->returnValueMap([
+ $this->userManager->method('get')->willReturnMap([
['sharedBy', $sharedBy],
['sharedWith', $sharedWith],
- ]));
+ ]);
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
- ]));
+ ]);
$this->defaultProvider
->method('getSharesByPath')
@@ -1215,9 +1215,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'no'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1240,10 +1240,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1263,10 +1263,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
$this->assertNull($this->invokePrivate($this->manager, 'groupCreateChecks', [$share]));
}
@@ -1292,10 +1292,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1325,9 +1325,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
@@ -1349,9 +1349,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1366,9 +1366,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'no'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1384,9 +1384,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1402,10 +1402,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'no']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
@@ -1417,10 +1417,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'yes']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1433,10 +1433,10 @@ class ManagerTest extends \Test\TestCase {
$this->config
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_links', 'yes', 'yes'],
['core', 'shareapi_allow_public_upload', 'yes', 'no']
- ]));
+ ]);
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
$this->addToAssertionCount(1);
@@ -1525,10 +1525,10 @@ class ManagerTest extends \Test\TestCase {
$user = $this->createMock(IUser::class);
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_exclude_groups', 'no', $excludeGroups],
['core', 'shareapi_exclude_groups_list', '', $groupList],
- ]));
+ ]);
if ($setList !== null) {
$this->config->expects($this->once())
@@ -1573,9 +1573,9 @@ class ManagerTest extends \Test\TestCase {
*/
public function testCanShare($expected, $sharingEnabled, $disabledForUser) {
$this->config->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_enabled', 'yes', $sharingEnabled],
- ]));
+ ]);
$manager = $this->createManagerMock()
->setMethods(['sharingDisabledForUser'])
@@ -1639,7 +1639,7 @@ class ManagerTest extends \Test\TestCase {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -1692,7 +1692,7 @@ class ManagerTest extends \Test\TestCase {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -1773,9 +1773,9 @@ class ManagerTest extends \Test\TestCase {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnCallback(function(Share $share) {
+ ->willReturnCallback(function(Share $share) {
return $share->setId(42);
- }));
+ });
// Pre share
$this->eventDispatcher->expects($this->at(0))
@@ -1882,9 +1882,9 @@ class ManagerTest extends \Test\TestCase {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnCallback(function(Share $share) {
+ ->willReturnCallback(function(Share $share) {
return $share->setId(42);
- }));
+ });
// Pre share
$this->eventDispatcher->expects($this->at(0))
@@ -1993,10 +1993,10 @@ class ManagerTest extends \Test\TestCase {
->with(
$this->equalTo('OCP\Share::preShare'),
$this->isInstanceOf(GenericEvent::class)
- )->will($this->returnCallback(function($name, GenericEvent $e) {
+ )->willReturnCallback(function($name, GenericEvent $e) {
$e->setArgument('error', 'I won\'t let you share!');
$e->stopPropagation();
- })
+ }
);
$manager->createShare($share);
@@ -2062,7 +2062,7 @@ class ManagerTest extends \Test\TestCase {
->expects($this->once())
->method('create')
->with($share)
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$share->expects($this->once())
->method('setShareOwner')
@@ -2145,22 +2145,22 @@ class ManagerTest extends \Test\TestCase {
*/
$this->defaultProvider
->method('getSharesBy')
- ->will($this->returnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
+ ->willReturnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
return array_slice($shares2, $offset, $limit);
- }));
+ });
/*
* Simulate the deleteShare call.
*/
$manager->method('deleteShare')
- ->will($this->returnCallback(function($share) use (&$shares2) {
+ ->willReturnCallback(function($share) use (&$shares2) {
for($i = 0; $i < count($shares2); $i++) {
if ($shares2[$i]->getId() === $share->getId()) {
array_splice($shares2, $i, 1);
break;
}
}
- }));
+ });
$res = $manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_LINK, $node, true, 3, 0);
@@ -2255,13 +2255,13 @@ class ManagerTest extends \Test\TestCase {
$factory->expects($this->any())
->method('getProviderForType')
- ->will($this->returnCallback(function($shareType) use ($roomShareProvider) {
+ ->willReturnCallback(function($shareType) use ($roomShareProvider) {
if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) {
throw new Exception\ProviderException();
}
return $roomShareProvider;
- }));
+ });
$roomShareProvider->expects($this->once())
->method('getShareByToken')
@@ -2409,9 +2409,9 @@ class ManagerTest extends \Test\TestCase {
$this->config
->expects($this->at(1))
->method('getAppValue')
- ->will($this->returnValueMap([
+ ->willReturnMap([
['core', 'shareapi_allow_public_upload', 'yes', 'no'],
- ]));
+ ]);
$this->defaultProvider->expects($this->once())
->method('getShareByToken')
@@ -2464,11 +2464,11 @@ class ManagerTest extends \Test\TestCase {
->setPassword('passwordHash');
$this->hasher->method('verify')->with('password', 'passwordHash', '')
- ->will($this->returnCallback(function($pass, $hash, &$newHash) {
+ ->willReturnCallback(function($pass, $hash, &$newHash) {
$newHash = 'newHash';
return true;
- }));
+ });
$this->defaultProvider->expects($this->once())
->method('update')
@@ -2607,7 +2607,7 @@ class ManagerTest extends \Test\TestCase {
\OCP\Util::connectHook('OCP\Share', 'post_set_expiration_date', $hookListner, 'post');
$hookListner->expects($this->never())->method('post');
- $this->rootFolder->method('getUserFolder')->with('newUser')->will($this->returnSelf());
+ $this->rootFolder->method('getUserFolder')->with('newUser')->willReturnSelf();
$this->rootFolder->method('getRelativePath')->with('/newUser/files/myPath')->willReturn('/myPath');
$hookListner2 = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock();
@@ -3294,7 +3294,7 @@ class ManagerTest extends \Test\TestCase {
$share->setSharedWith('recipient');
- $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
+ $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0);
$this->manager->moveShare($share, 'recipient');
$this->addToAssertionCount(1);
@@ -3352,7 +3352,7 @@ class ManagerTest extends \Test\TestCase {
$this->groupManager->method('get')->with('group')->willReturn($group);
$this->userManager->method('get')->with('recipient')->willReturn($recipient);
- $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0));
+ $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0);
$this->manager->moveShare($share, 'recipient');
$this->addToAssertionCount(1);
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index a5a54fce09f..2e9687b0ad3 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -439,13 +439,13 @@ class SystemTagManagerTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('test'));
+ ->willReturn('test');
$tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable);
$this->groupManager->expects($this->any())
->method('isAdmin')
->with('test')
- ->will($this->returnValue($isAdmin));
+ ->willReturn($isAdmin);
$this->assertEquals($expectedResult, $this->tagManager->canUserSeeTag($tag1, $user));
}
@@ -486,18 +486,18 @@ class SystemTagManagerTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('test'));
+ ->willReturn('test');
$tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable);
$this->tagManager->setTagGroups($tag1, $tagGroupIds);
$this->groupManager->expects($this->any())
->method('isAdmin')
->with('test')
- ->will($this->returnValue($isAdmin));
+ ->willReturn($isAdmin);
$this->groupManager->expects($this->any())
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue($userGroupIds));
+ ->willReturn($userGroupIds);
$this->assertEquals($expectedResult, $this->tagManager->canUserAssignTag($tag1, $user));
}
diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
index f0e535b0f67..986686dc93e 100644
--- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php
+++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
@@ -88,7 +88,7 @@ class SystemTagObjectMapperTest extends TestCase {
$this->tagManager->expects($this->any())
->method('getTagsByIds')
- ->will($this->returnCallback(function($tagIds) {
+ ->willReturnCallback(function($tagIds) {
$result = [];
if (in_array(1, $tagIds)) {
$result[1] = $this->tag1;
@@ -100,7 +100,7 @@ class SystemTagObjectMapperTest extends TestCase {
$result[3] = $this->tag3;
}
return $result;
- }));
+ });
$this->tagMapper->assignTags('1', 'testtype', $this->tag1->getId());
$this->tagMapper->assignTags('1', 'testtype', $this->tag2->getId());
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index db0a77f68f0..08d8ffb7921 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -57,7 +57,7 @@ class TagsTest extends \Test\TestCase {
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue($this->user));
+ ->willReturn($this->user);
$this->objectType = $this->getUniqueID('type_');
$this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
@@ -78,7 +78,7 @@ class TagsTest extends \Test\TestCase {
$this->userSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
$this->assertNull($this->tagMgr->load($this->objectType));
}
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index b12124ea5a9..7a2ced51725 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -121,7 +121,7 @@ class JSCombinerTest extends \Test\TestCase {
$fileDeps = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -130,7 +130,7 @@ class JSCombinerTest extends \Test\TestCase {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -158,7 +158,7 @@ class JSCombinerTest extends \Test\TestCase {
$gzfile = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile) {
+ ->willReturnCallback(function($path) use ($file, $gzfile) {
if ($path === 'combine.js') {
return $file;
} else if ($path === 'combine.js.deps') {
@@ -167,7 +167,7 @@ class JSCombinerTest extends \Test\TestCase {
return $gzfile;
}
$this->fail();
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with('combine.js.deps')
@@ -201,7 +201,7 @@ class JSCombinerTest extends \Test\TestCase {
->willReturn(true);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $fileDeps) {
+ ->willReturnCallback(function($path) use ($file, $fileDeps) {
if ($path === 'combine.js') {
return $file;
}
@@ -211,7 +211,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -246,12 +246,12 @@ class JSCombinerTest extends \Test\TestCase {
->willReturn('{}');
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
$this->fail();
- }));
+ });
$actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp');
$this->assertTrue($actual);
@@ -263,7 +263,7 @@ class JSCombinerTest extends \Test\TestCase {
$file = $this->createMock(ISimpleFile::class);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'combine.js') {
return $file;
}
@@ -271,7 +271,7 @@ class JSCombinerTest extends \Test\TestCase {
throw new NotFoundException();
}
$this->fail();
- }));
+ });
$actual = self::invokePrivate($this->jsCombiner, 'isCached', [$fileName, $folder]);
$this->assertFalse($actual);
@@ -345,7 +345,7 @@ class JSCombinerTest extends \Test\TestCase {
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(
+ $folder->method('newFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -356,7 +356,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -376,7 +376,7 @@ class JSCombinerTest extends \Test\TestCase {
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -387,7 +387,7 @@ class JSCombinerTest extends \Test\TestCase {
}
$this->fail();
}
- ));
+ );
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -444,7 +444,7 @@ var b = \'world\';
$path = __DIR__ . '/data/';
- $folder->method('getFile')->will($this->returnCallback(
+ $folder->method('getFile')->willReturnCallback(
function ($filename) use ($file, $depsFile, $gzFile) {
if ($filename === 'combine.js') {
return $file;
@@ -455,7 +455,7 @@ var b = \'world\';
}
$this->fail();
}
- ));
+ );
$file->expects($this->at(0))
->method('putContent')
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php
index 6f9fdf1e7fb..9e8c30961fb 100644
--- a/tests/lib/Template/SCSSCacherTest.php
+++ b/tests/lib/Template/SCSSCacherTest.php
@@ -121,7 +121,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -131,7 +131,7 @@ class SCSSCacherTest extends \Test\TestCase {
} else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -161,7 +161,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
+ ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) {
if ($path === $filePrefix.'styles.css') {
return $file;
} else if ($path === $filePrefix.'styles.css.deps') {
@@ -171,7 +171,7 @@ class SCSSCacherTest extends \Test\TestCase {
}else {
$this->fail();
}
- }));
+ });
$folder->expects($this->once())
->method('newFile')
->with($filePrefix.'styles.css.deps')
@@ -197,7 +197,7 @@ class SCSSCacherTest extends \Test\TestCase {
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -206,7 +206,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -235,7 +235,7 @@ class SCSSCacherTest extends \Test\TestCase {
$filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
$folder->method('getFile')
- ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
+ ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
if ($name === $filePrefix.'styles.css') {
return $file;
} else if ($name === $filePrefix.'styles.css.deps') {
@@ -244,7 +244,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzFile;
}
$this->fail();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -273,7 +273,7 @@ class SCSSCacherTest extends \Test\TestCase {
$file->expects($this->once())->method('getSize')->willReturn(1);
$folder->method('getFile')
- ->will($this->returnCallback(function($path) use ($file) {
+ ->willReturnCallback(function($path) use ($file) {
if ($path === 'styles.css') {
return $file;
} else if ($path === 'styles.css.deps') {
@@ -281,7 +281,7 @@ class SCSSCacherTest extends \Test\TestCase {
} else {
$this->fail();
}
- }));
+ });
$this->appData->expects($this->any())
->method('getFolder')
@@ -301,7 +301,7 @@ class SCSSCacherTest extends \Test\TestCase {
$path = \OC::$SERVERROOT . '/core/css/';
$folder->method('getFile')->willThrowException(new NotFoundException());
- $folder->method('newFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('newFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -310,7 +310,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->any())
->method('setIconsCss')
@@ -335,7 +335,7 @@ class SCSSCacherTest extends \Test\TestCase {
$webDir = "core/css";
$path = \OC::$SERVERROOT;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles.css') {
return $file;
} else if ($fileName === 'styles.css.deps') {
@@ -344,7 +344,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$file->expects($this->once())->method('putContent');
$depsFile->expects($this->once())->method('putContent');
@@ -369,7 +369,7 @@ class SCSSCacherTest extends \Test\TestCase {
$webDir = "tests/data/scss";
$path = \OC::$SERVERROOT . $webDir;
- $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
+ $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
if ($fileName === 'styles-success.css') {
return $file;
} else if ($fileName === 'styles-success.css.deps') {
@@ -378,7 +378,7 @@ class SCSSCacherTest extends \Test\TestCase {
return $gzipFile;
}
throw new \Exception();
- }));
+ });
$this->iconsCacher->expects($this->at(0))
->method('setIconsCss')
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index b80e720efd3..b76105e9346 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -479,9 +479,9 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
$l10n
->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($text, $parameters = array()) {
+ ->willReturnCallback(function($text, $parameters = array()) {
return vsprintf($text, $parameters);
- }));
+ });
$t = new Base($template, $requestToken, $l10n, $theme);
$buf = $t->fetchPage($vars);
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index b25557d5569..2f139319bbf 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -74,12 +74,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(time()));
+ ->willReturn(time());
$this->config
->expects($this->at(2))
->method('getAppValue')
->with('core', 'lastupdateResult')
- ->will($this->returnValue(json_encode($expectedResult)));
+ ->willReturn(json_encode($expectedResult));
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -104,7 +104,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -118,12 +118,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -142,7 +142,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -157,7 +157,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -171,12 +171,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -187,7 +187,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame([], $this->updater->check());
}
@@ -212,7 +212,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -226,12 +226,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$updateXml = '<?xml version="1.0"?>
<owncloud>
@@ -245,7 +245,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -262,7 +262,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -276,12 +276,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
$this->config
->expects($this->at(7))
->method('setAppValue')
@@ -292,7 +292,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
@@ -317,7 +317,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config
->expects($this->at(2))
->method('getSystemValue')
@@ -331,12 +331,12 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
- ->will($this->returnValue('installedat'));
+ ->willReturn('installedat');
$this->config
->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
- ->will($this->returnValue('lastupdatedat'));
+ ->willReturn('lastupdatedat');
// missing autoupdater element should still not fail
$updateXml = '<?xml version="1.0"?>
@@ -350,7 +350,7 @@ class VersionCheckTest extends \Test\TestCase {
->expects($this->once())
->method('getUrlContent')
->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/'))
- ->will($this->returnValue($updateXml));
+ ->willReturn($updateXml);
$this->assertSame($expectedResult, $this->updater->check());
}
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 40197101fd6..1dc0182a960 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -60,7 +60,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -76,7 +76,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -98,7 +98,7 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -107,7 +107,7 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -124,7 +124,7 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -148,17 +148,17 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('checkPassword')
->with($this->equalTo('foo'), $this->equalTo('bar'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\USER\BACKEND::CHECK_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -177,7 +177,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -193,7 +193,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -211,7 +211,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -227,7 +227,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('bLeNdEr'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -245,7 +245,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'))
- ->will($this->returnValue(array('foo', 'afoo', 'Afoo1', 'Bfoo')));
+ ->willReturn(array('foo', 'afoo', 'Afoo1', 'Bfoo'));
$backend->expects($this->never())
->method('loginName2UserName');
@@ -268,7 +268,7 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
- ->will($this->returnValue(array('foo1', 'foo2')));
+ ->willReturn(array('foo1', 'foo2'));
$backend1->expects($this->never())
->method('loginName2UserName');
@@ -279,7 +279,7 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
- ->will($this->returnValue(array('foo3')));
+ ->willReturn(array('foo3'));
$backend2->expects($this->never())
->method('loginName2UserName');
@@ -351,7 +351,7 @@ class ManagerTest extends TestCase {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('createUser')
@@ -360,7 +360,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->never())
->method('loginName2UserName');
@@ -381,7 +381,7 @@ class ManagerTest extends TestCase {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->never())
->method('createUser');
@@ -389,7 +389,7 @@ class ManagerTest extends TestCase {
$backend->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -404,7 +404,7 @@ class ManagerTest extends TestCase {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->never())
->method('createUser');
@@ -453,7 +453,7 @@ class ManagerTest extends TestCase {
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->never())
->method('createUser');
@@ -461,7 +461,7 @@ class ManagerTest extends TestCase {
$backend1->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -469,7 +469,7 @@ class ManagerTest extends TestCase {
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->never())
->method('createUser');
@@ -477,7 +477,7 @@ class ManagerTest extends TestCase {
$backend2->expects($this->once())
->method('userExists')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -501,16 +501,16 @@ class ManagerTest extends TestCase {
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(7));
+ ->willReturn(7);
$backend->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
@@ -530,28 +530,28 @@ class ManagerTest extends TestCase {
$backend1 = $this->createMock(\Test\Util\User\Dummy::class);
$backend1->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(7));
+ ->willReturn(7);
$backend1->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend1->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$backend2 = $this->createMock(\Test\Util\User\Dummy::class);
$backend2->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(16));
+ ->willReturn(16);
$backend2->expects($this->once())
->method('implementsActions')
->with(\OC\USER\BACKEND::COUNT_USERS)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend2->expects($this->once())
->method('getBackendName')
- ->will($this->returnValue('Mock_Test_Util_User_Dummy'));
+ ->willReturn('Mock_Test_Util_User_Dummy');
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend1);
@@ -672,21 +672,21 @@ class ManagerTest extends TestCase {
->expects($this->at(0))
->method('getUsersForUserValueCaseInsensitive')
->with('settings', 'email', 'test@example.com')
- ->will($this->returnValue(['uid1', 'uid99', 'uid2']));
+ ->willReturn(['uid1', 'uid99', 'uid2']);
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->at(0))
->method('userExists')
->with($this->equalTo('uid1'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->at(1))
->method('userExists')
->with($this->equalTo('uid99'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->at(2))
->method('userExists')
->with($this->equalTo('uid2'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$manager = new \OC\User\Manager($config, $this->oldDispatcher, $this->eventDispatcher);
$manager->registerBackend($backend);
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index e7df7578c7d..c96a07eb9af 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -67,7 +67,7 @@ class SessionTest extends \Test\TestCase {
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
->method('getTime')
- ->will($this->returnValue(10000));
+ ->willReturn(10000);
$this->tokenProvider = $this->createMock(IProvider::class);
$this->config = $this->createMock(IConfig::class);
$this->throttler = $this->createMock(Throttler::class);
@@ -105,12 +105,12 @@ class SessionTest extends \Test\TestCase {
$expectedUser = $this->createMock(IUser::class);
$expectedUser->expects($this->any())
->method('getUID')
- ->will($this->returnValue('user123'));
+ ->willReturn('user123');
$session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
$session->expects($this->at(0))
->method('get')
->with('user_id')
- ->will($this->returnValue($expectedUser->getUID()));
+ ->willReturn($expectedUser->getUID());
$sessionId = 'abcdef12345';
$manager = $this->getMockBuilder('\OC\User\Manager')
@@ -119,25 +119,25 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->at(1))
->method('get')
->with('app_password')
- ->will($this->returnValue(null)); // No password set -> browser session
+ ->willReturn(null); // No password set -> browser session
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$this->tokenProvider->expects($this->once())
->method('getPassword')
->with($token, $sessionId)
- ->will($this->returnValue('passme'));
+ ->willReturn('passme');
$manager->expects($this->once())
->method('checkPassword')
->with('User123', 'passme')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$expectedUser->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->tokenProvider->expects($this->once())
->method('updateTokenActivity')
@@ -146,7 +146,7 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with($expectedUser->getUID())
- ->will($this->returnValue($expectedUser));
+ ->willReturn($expectedUser);
$userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$user = $userSession->getUser();
@@ -178,7 +178,7 @@ class SessionTest extends \Test\TestCase {
$user = new User('sepp', null, $this->createMock(EventDispatcherInterface::class));
$userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($isLoggedIn ? $user : null));
+ ->willReturn($isLoggedIn ? $user : null);
$this->assertEquals($isLoggedIn, $userSession->isLoggedIn());
}
@@ -195,7 +195,7 @@ class SessionTest extends \Test\TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$userSession->setUser($user);
@@ -240,17 +240,17 @@ class SessionTest extends \Test\TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$user->expects($this->once())
->method('updateLastLoginTimestamp');
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher])
@@ -304,14 +304,14 @@ class SessionTest extends \Test\TestCase {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user->expects($this->never())
->method('updateLastLoginTimestamp');
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->dispatcher->expects($this->never())
->method('dispatch');
@@ -355,7 +355,7 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->dispatcher->expects($this->never())
->method('dispatch');
@@ -380,7 +380,7 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->login('foo', 'bar');
}
@@ -404,12 +404,12 @@ class SessionTest extends \Test\TestCase {
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('bar')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$manager->expects($this->once())
->method('checkPasswordNoLogging')
->with('foo', 'bar')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->login('foo', 'bar');
}
@@ -435,7 +435,7 @@ class SessionTest extends \Test\TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$request
->expects($this->any())
->method('getRemoteAddress')
@@ -471,7 +471,7 @@ class SessionTest extends \Test\TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$manager->method('getByEmail')
->with('unexist')
->willReturn([]);
@@ -492,11 +492,11 @@ class SessionTest extends \Test\TestCase {
$userSession->expects($this->once())
->method('isTokenPassword')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$userSession->expects($this->once())
->method('login')
->with('john', 'I-AM-AN-APP-PASSWORD')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$session->expects($this->once())
->method('set')
@@ -539,12 +539,12 @@ class SessionTest extends \Test\TestCase {
$this->config->expects($this->once())
->method('getSystemValue')
->with('token_auth_enforced', false)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->expects($this->once())
->method('isTwoFactorEnforced')
->with('john')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$request
->expects($this->any())
@@ -592,18 +592,18 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue([$token]));
+ ->willReturn([$token]);
$this->config->expects($this->once())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
$this->random->expects($this->once())
->method('generate')
->with(32)
- ->will($this->returnValue('abcdefg123456'));
+ ->willReturn('abcdefg123456');
$this->config->expects($this->once())
->method('setUserValue')
->with('foo', 'login_token', 'abcdefg123456', 10000);
@@ -617,7 +617,7 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('renewSessionToken')
->with($oldSessionId, $sessionId)
@@ -628,7 +628,7 @@ class SessionTest extends \Test\TestCase {
$user->expects($this->any())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession->expects($this->once())
->method('setMagicInCookie');
$user->expects($this->once())
@@ -636,11 +636,11 @@ class SessionTest extends \Test\TestCase {
$setUID = false;
$session
->method('set')
- ->will($this->returnCallback(function ($k, $v) use (&$setUID) {
+ ->willReturnCallback(function ($k, $v) use (&$setUID) {
if ($k === 'user_id' && $v === 'foo') {
$setUID = true;
}
- }));
+ });
$userSession->expects($this->once())
->method('setLoginName')
->willReturn('foobar');
@@ -681,11 +681,11 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue([$token]));
+ ->willReturn([$token]);
$this->config->expects($this->once())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
@@ -694,7 +694,7 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('renewSessionToken')
->with($oldSessionId, $sessionId)
@@ -702,7 +702,7 @@ class SessionTest extends \Test\TestCase {
$user->expects($this->never())
->method('getUID')
- ->will($this->returnValue('foo'));
+ ->willReturn('foo');
$userSession->expects($this->never())
->method('setMagicInCookie');
$user->expects($this->never())
@@ -744,11 +744,11 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->config->expects($this->once())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue(['anothertoken']));
+ ->willReturn(['anothertoken']);
$this->config->expects($this->never())
->method('deleteUserValue')
->with('foo', 'login_token', $token);
@@ -794,11 +794,11 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with('foo')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->config->expects($this->never())
->method('getUserKeys')
->with('foo', 'login_token')
- ->will($this->returnValue(['anothertoken']));
+ ->willReturn(['anothertoken']);
$this->tokenProvider->expects($this->never())
->method('renewSessionToken');
@@ -825,9 +825,9 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->any())
->method('get')
- ->will($this->returnCallback(function ($uid) use ($users) {
+ ->willReturnCallback(function ($uid) use ($users) {
return $users[$uid];
- }));
+ });
$session = new Memory('');
$session->set('user_id', 'foo');
@@ -873,10 +873,10 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
@@ -914,10 +914,10 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
@@ -959,18 +959,18 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$this->tokenProvider->expects($this->once())
->method('getToken')
->with($password)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$this->tokenProvider->expects($this->once())
->method('getPassword')
->with($token, $password)
- ->will($this->returnValue($realPassword));
+ ->willReturn($realPassword);
$this->tokenProvider->expects($this->once())
->method('generateToken')
@@ -994,7 +994,7 @@ class SessionTest extends \Test\TestCase {
$manager->expects($this->once())
->method('get')
->with($uid)
- ->will($this->returnValue(null));
+ ->willReturn(null);
$this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password));
}
@@ -1021,18 +1021,18 @@ class SessionTest extends \Test\TestCase {
$request->expects($this->once())
->method('getHeader')
->with('Authorization')
- ->will($this->returnValue('Bearer xxxxx'));
+ ->willReturn('Bearer xxxxx');
$this->tokenProvider->expects($this->once())
->method('getToken')
->with('xxxxx')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$manager->expects($this->once())
->method('get')
->with('fritz0')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$userSession->tryTokenLogin($request);
}
@@ -1055,23 +1055,23 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
- ->will($this->returnValue('123456'));
+ ->willReturn('123456');
$userManager->expects($this->never())
->method('checkPassword');
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$tokenProvider->expects($this->once())
->method('invalidateToken')
->with('APP-PASSWORD');
@@ -1099,14 +1099,14 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
@@ -1135,25 +1135,25 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('get')
->with('app_password')
- ->will($this->returnValue('APP-PASSWORD'));
+ ->willReturn('APP-PASSWORD');
$tokenProvider->expects($this->once())
->method('getToken')
->with('APP-PASSWORD')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$timeFactory->expects($this->once())
->method('getTime')
- ->will($this->returnValue(1000)); // more than 5min since last check
+ ->willReturn(1000); // more than 5min since last check
$tokenProvider->expects($this->once())
->method('getPassword')
->with($token, 'APP-PASSWORD')
- ->will($this->returnValue('123456'));
+ ->willReturn('123456');
$userManager->expects($this->once())
->method('checkPassword')
->with('susan', '123456')
->willReturn(false);
$user->expects($this->once())
->method('isEnabled')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$tokenProvider->expects($this->never())
->method('invalidateToken');
$tokenProvider->expects($this->once())
@@ -1179,11 +1179,11 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$tokenProvider->expects($this->once())
->method('setPassword')
->with($token, $sessionId, $password);
@@ -1218,11 +1218,11 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('getId')
- ->will($this->returnValue($sessionId));
+ ->willReturn($sessionId);
$tokenProvider->expects($this->once())
->method('getToken')
->with($sessionId)
- ->will($this->returnValue($token));
+ ->willReturn($token);
$tokenProvider->expects($this->once())
->method('setPassword')
->with($token, $sessionId, $password)
@@ -1254,7 +1254,7 @@ class SessionTest extends \Test\TestCase {
$mapper->expects($this->any())
->method('getToken')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$mapper->expects($this->once())
->method('update');
$request
@@ -1273,7 +1273,7 @@ class SessionTest extends \Test\TestCase {
$this->timeFactory
->expects($this->any())
->method('getTime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$manager->method('getByEmail')
->with('john')
@@ -1308,7 +1308,7 @@ class SessionTest extends \Test\TestCase {
$mapper->expects($this->any())
->method('getToken')
- ->will($this->returnValue($token));
+ ->willReturn($token);
$mapper->expects($this->never())
->method('update');
$request
@@ -1327,7 +1327,7 @@ class SessionTest extends \Test\TestCase {
$this->timeFactory
->expects($this->any())
->method('getTime')
- ->will($this->returnValue(100));
+ ->willReturn(100);
$manager->method('getByEmail')
->with('john')
@@ -1375,7 +1375,7 @@ class SessionTest extends \Test\TestCase {
$this->session
->method('set')
- ->will($this->returnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) {
+ ->willReturnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) {
switch ($k) {
case Auth::DAV_AUTHENTICATED:
$davAuthenticatedSet = $v;
@@ -1386,7 +1386,7 @@ class SessionTest extends \Test\TestCase {
default:
throw new \Exception();
}
- }));
+ });
$userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index 8431f14f8a2..4e527addc6e 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -47,12 +47,12 @@ class UserTest extends TestCase {
$backend->expects($this->once())
->method('getDisplayName')
->with($this->equalTo('foo'))
- ->will($this->returnValue('Foo'));
+ ->willReturn('Foo');
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('Foo', $user->getDisplayName());
@@ -69,12 +69,12 @@ class UserTest extends TestCase {
$backend->expects($this->once())
->method('getDisplayName')
->with($this->equalTo('foo'))
- ->will($this->returnValue(' '));
+ ->willReturn(' ');
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('foo', $user->getDisplayName());
@@ -91,7 +91,7 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('foo', $user->getDisplayName());
@@ -108,13 +108,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->setPassword('bar',''));
@@ -130,7 +130,7 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->setPassword('bar',''));
@@ -144,17 +144,17 @@ class UserTest extends TestCase {
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::PROVIDE_AVATAR) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangeAvatar());
@@ -168,17 +168,17 @@ class UserTest extends TestCase {
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::PROVIDE_AVATAR) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangeAvatar());
@@ -221,13 +221,13 @@ class UserTest extends TestCase {
$backend->expects($this->at(0))
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::GET_HOME) {
return true;
} else {
return false;
}
- }));
+ });
// important: getHome MUST be called before deleteUser because
// once the user is deleted, getHome implementations might not
@@ -235,7 +235,7 @@ class UserTest extends TestCase {
$backend->expects($this->at(1))
->method('getHome')
->with($this->equalTo('foo'))
- ->will($this->returnValue('/home/foo'));
+ ->willReturn('/home/foo');
$backend->expects($this->at(2))
->method('deleteUser')
@@ -253,17 +253,17 @@ class UserTest extends TestCase {
$backend->expects($this->once())
->method('getHome')
->with($this->equalTo('foo'))
- ->will($this->returnValue('/home/foo'));
+ ->willReturn('/home/foo');
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::GET_HOME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertEquals('/home/foo', $user->getHome());
@@ -286,18 +286,18 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$allConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$allConfig->expects($this->any())
->method('getUserValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$allConfig->expects($this->any())
->method('getSystemValue')
->with($this->equalTo('datadirectory'))
- ->will($this->returnValue('arbitrary/path'));
+ ->willReturn('arbitrary/path');
$user = new User('foo', $backend, $this->dispatcher, null, $allConfig);
$this->assertEquals('arbitrary/path/foo', $user->getHome());
@@ -311,13 +311,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangePassword());
@@ -331,7 +331,7 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangePassword());
@@ -345,13 +345,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertTrue($user->canChangeDisplayName());
@@ -365,7 +365,7 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->canChangeDisplayName());
@@ -379,13 +379,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$backend->expects($this->once())
->method('setDisplayName')
@@ -408,13 +408,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_DISPLAYNAME) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher);
$this->assertFalse($user->setDisplayName(' '));
@@ -466,13 +466,13 @@ class UserTest extends TestCase {
$backend->expects($this->any())
->method('implementsActions')
- ->will($this->returnCallback(function ($actions) {
+ ->willReturnCallback(function ($actions) {
if ($actions === \OC\User\Backend::SET_PASSWORD) {
return true;
} else {
return false;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, $emitter);
@@ -751,13 +751,13 @@ class UserTest extends TestCase {
$config = $this->createMock(IConfig::class);
$config->method('getUserValue')
- ->will($this->returnCallback(function ($uid, $app, $key, $default) {
+ ->willReturnCallback(function ($uid, $app, $key, $default) {
if ($uid === 'foo' && $app === 'login' && $key === 'lastLogin') {
return 42;
} else {
return $default;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, null, $config);
$this->assertSame(42, $user->getLastLogin());
@@ -861,13 +861,13 @@ class UserTest extends TestCase {
$config = $this->createMock(IConfig::class);
$config->method('getUserValue')
- ->will($this->returnCallback(function ($uid, $app, $key, $default) {
+ ->willReturnCallback(function ($uid, $app, $key, $default) {
if ($uid === 'foo' && $app === 'settings' && $key === 'email') {
return 'foo@bar.com';
} else {
return $default;
}
- }));
+ });
$user = new User('foo', $backend, $this->dispatcher, null, $config);
$this->assertSame('foo@bar.com', $user->getEMailAddress());
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index 3f956601ce4..9cba59beb47 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -30,9 +30,9 @@ class UtilCheckServerTest extends \Test\TestCase {
$config->expects($this->any())
->method('getValue')
- ->will($this->returnCallback(function ($key, $default) use ($systemOptions) {
+ ->willReturnCallback(function ($key, $default) use ($systemOptions) {
return isset($systemOptions[$key]) ? $systemOptions[$key] : $default;
- }));
+ });
return $config;
}
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index a5ddd50ab27..94ac17ce345 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -187,18 +187,18 @@ class UtilTest extends \Test\TestCase {
->expects($this->at(0))
->method('getAppValue')
->with('core', 'shareapi_exclude_groups', 'no')
- ->will($this->returnValue('yes'));
+ ->willReturn('yes');
$config
->expects($this->at(1))
->method('getAppValue')
->with('core', 'shareapi_exclude_groups_list')
- ->will($this->returnValue(json_encode($excludedGroups)));
+ ->willReturn(json_encode($excludedGroups));
$groupManager
->expects($this->at(0))
->method('getUserGroupIds')
->with($user)
- ->will($this->returnValue($membership));
+ ->willReturn($membership);
$result = \OC_Util::isSharingDisabledForUser($config, $groupManager, $user);
@@ -233,9 +233,9 @@ class UtilTest extends \Test\TestCase {
$appManager = $this->createMock(IAppManager::class);
$appManager->expects($this->any())
->method('isEnabledForUser')
- ->will($this->returnCallback(function($appId) use ($enabledApps){
+ ->willReturnCallback(function($appId) use ($enabledApps){
return in_array($appId, $enabledApps);
- }));
+ });
Dummy_OC_Util::$appManager = $appManager;
// need to set a user id to make sure enabled apps are read from cache