diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-06-07 17:53:00 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-06-07 18:17:29 +0200 |
commit | 3e3b326c85d31f69cbc30aa8b9aaa65d4ce04087 (patch) | |
tree | c38766cd67b9c260c3b07d83869822bbe80669c3 /tests | |
parent | 46fe2ddf2e7a4413586095143521684a0377daad (diff) | |
download | nextcloud-server-3e3b326c85d31f69cbc30aa8b9aaa65d4ce04087.tar.gz nextcloud-server-3e3b326c85d31f69cbc30aa8b9aaa65d4ce04087.zip |
Allow to cancel 2FA after login
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Core/Controller/TwoFactorChallengeControllerTest.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 2da6dcd52ac..08d8dd1452c 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -33,7 +33,7 @@ class TwoFactorChallengeControllerTest extends TestCase { private $session; private $urlGenerator; - /** TwoFactorChallengeController */ + /** @var TwoFactorChallengeController|\PHPUnit_Framework_MockObject_MockObject */ private $controller; protected function setUp() { @@ -47,9 +47,20 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->session = $this->getMock('\OCP\ISession'); $this->urlGenerator = $this->getMock('\OCP\IURLGenerator'); - $this->controller = new TwoFactorChallengeController( - 'core', $this->request, $this->twoFactorManager, $this->userSession, $this->session, $this->urlGenerator - ); + $this->controller = $this->getMockBuilder('OC\Core\Controller\TwoFactorChallengeController') + ->setConstructorArgs([ + 'core', + $this->request, + $this->twoFactorManager, + $this->userSession, + $this->session, + $this->urlGenerator, + ]) + ->setMethods(['getLogoutAttribute']) + ->getMock(); + $this->controller->expects($this->any()) + ->method('getLogoutAttribute') + ->willReturn('logoutAttribute'); } public function testSelectChallenge() { @@ -70,6 +81,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $expected = new \OCP\AppFramework\Http\TemplateResponse('core', 'twofactorselectchallenge', [ 'providers' => $providers, 'redirect_url' => '/some/url', + 'logout_attribute' => 'logoutAttribute', ], 'guest'); $this->assertEquals($expected, $this->controller->selectChallenge('/some/url')); @@ -110,6 +122,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $expected = new \OCP\AppFramework\Http\TemplateResponse('core', 'twofactorshowchallenge', [ 'error' => true, 'provider' => $provider, + 'logout_attribute' => 'logoutAttribute', 'template' => '<html/>', ], 'guest'); |