summaryrefslogtreecommitdiffstats
path: root/tests/Core/Controller/TwoFactorChallengeControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Core/Controller/TwoFactorChallengeControllerTest.php')
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php64
1 files changed, 32 insertions, 32 deletions
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')