aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
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/lib/Authentication/Token/DefaultTokenProviderTest.php
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/lib/Authentication/Token/DefaultTokenProviderTest.php')
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php22
1 files changed, 11 insertions, 11 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);