summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /apps/encryption
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
downloadnextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz
nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php8
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php4
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php4
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php4
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php2
-rw-r--r--apps/encryption/tests/RecoveryTest.php6
-rw-r--r--apps/encryption/tests/SessionTest.php6
-rw-r--r--apps/encryption/tests/UtilTest.php6
8 files changed, 20 insertions, 20 deletions
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index e3614b918c3..c6f7a8649b6 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -108,10 +108,10 @@ class RecoveryControllerTest extends TestCase {
$this->recoveryMock->expects($this->any())
->method('changeRecoveryKeyPassword')
->with($password, $oldPassword)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['test', 'oldTestFail', false],
['test', 'oldtest', true]
- ]));
+ ]);
$response = $this->controller->changeRecoveryPassword($password,
$oldPassword,
@@ -140,10 +140,10 @@ class RecoveryControllerTest extends TestCase {
$this->recoveryMock->expects($this->any())
->method('setRecoveryForUser')
->with($enableRecovery)
- ->will($this->returnValueMap([
+ ->willReturnMap([
['1', true],
['0', false]
- ]));
+ ]);
$response = $this->controller->userSetRecovery($enableRecovery);
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 62c5ebf608c..c2f67478bb7 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -85,9 +85,9 @@ class SettingsControllerTest extends TestCase {
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($message) {
+ ->willReturnCallback(function($message) {
return $message;
- }));
+ });
$this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index 8e217bfa473..f93be963989 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -63,9 +63,9 @@ class StatusControllerTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
->method('t')
- ->will($this->returnCallback(function($message) {
+ ->willReturnCallback(function($message) {
return $message;
- }));
+ });
$this->encryptionManagerMock = $this->createMock(IManager::class);
$this->controller = new StatusController('encryptionTest',
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 7b563c06c02..9a541880e79 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -151,10 +151,10 @@ class EncryptionTest extends TestCase {
$this->keyManagerMock->expects($this->any())
->method('getPublicKey')
- ->will($this->returnCallback([$this, 'getPublicKeyCallback']));
+ ->willReturnCallback([$this, 'getPublicKeyCallback']);
$this->keyManagerMock->expects($this->any())
->method('addSystemKeys')
- ->will($this->returnCallback([$this, 'addSystemKeysCallback']));
+ ->willReturnCallback([$this, 'addSystemKeysCallback']);
$this->cryptMock->expects($this->any())
->method('multiKeyEncrypt')
->willReturn(true);
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index 4d35d546317..53548c7ccd8 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -307,7 +307,7 @@ class UserHooksTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $userSessionMock->expects($this->any())->method('getUser')->will($this->returnValue(null));
+ $userSessionMock->expects($this->any())->method('getUser')->willReturn(null);
$this->recoveryMock->expects($this->once())
->method('isRecoveryEnabledForUser')
diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php
index a76d5f7d562..9dbc818af3a 100644
--- a/apps/encryption/tests/RecoveryTest.php
+++ b/apps/encryption/tests/RecoveryTest.php
@@ -168,7 +168,7 @@ class RecoveryTest extends TestCase {
$this->cryptMock->expects($this->once())
->method('decryptPrivateKey')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->instance->changeRecoveryKeyPassword('password', 'passwordOld'));
}
@@ -283,11 +283,11 @@ class RecoveryTest extends TestCase {
$this->configMock->expects($this->any())
->method('setAppValue')
- ->will($this->returnCallback([$this, 'setValueTester']));
+ ->willReturnCallback([$this, 'setValueTester']);
$this->configMock->expects($this->any())
->method('getAppValue')
- ->will($this->returnCallback([$this, 'getValueTester']));
+ ->willReturnCallback([$this, 'getValueTester']);
$this->instance = new Recovery($this->userSessionMock,
$this->cryptMock,
diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php
index 21de1ee971c..daa05b140da 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -204,15 +204,15 @@ class SessionTest extends TestCase {
$this->sessionMock->expects($this->any())
->method('set')
- ->will($this->returnCallback([$this, "setValueTester"]));
+ ->willReturnCallback([$this, "setValueTester"]);
$this->sessionMock->expects($this->any())
->method('get')
- ->will($this->returnCallback([$this, "getValueTester"]));
+ ->willReturnCallback([$this, "getValueTester"]);
$this->sessionMock->expects($this->any())
->method('remove')
- ->will($this->returnCallback([$this, "removeValueTester"]));
+ ->willReturnCallback([$this, "removeValueTester"]);
$this->instance = new Session($this->sessionMock);
diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php
index cade0b2f823..e9133055f41 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -75,7 +75,7 @@ class UtilTest extends TestCase {
public function testUserHasFiles() {
$this->filesMock->expects($this->once())
->method('file_exists')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertTrue($this->instance->userHasFiles('admin'));
}
@@ -111,11 +111,11 @@ class UtilTest extends TestCase {
$this->configMock->expects($this->any())
->method('getUserValue')
- ->will($this->returnCallback([$this, 'getValueTester']));
+ ->willReturnCallback([$this, 'getValueTester']);
$this->configMock->expects($this->any())
->method('setUserValue')
- ->will($this->returnCallback([$this, 'setValueTester']));
+ ->willReturnCallback([$this, 'setValueTester']);
$this->instance = new Util($this->filesMock, $cryptMock, $loggerMock, $userSessionMock, $this->configMock, $this->userManagerMock);
}