summaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication')
-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
4 files changed, 28 insertions, 28 deletions
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);
}