Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-06-07 18:53:00 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2016-06-07 19:17:29 +0300
commit3e3b326c85d31f69cbc30aa8b9aaa65d4ce04087 (patch)
treec38766cd67b9c260c3b07d83869822bbe80669c3 /tests
parent46fe2ddf2e7a4413586095143521684a0377daad (diff)
Allow to cancel 2FA after login
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php21
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');