summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-08-31 19:46:38 +0200
committerGitHub <noreply@github.com>2016-08-31 19:46:38 +0200
commit2685129184472a308a3ba7730207816151b0ffd7 (patch)
tree60129965ee6469d2405cedccf6f04132f77b84e1 /tests
parent5fe25fa64832aa349628afe62336921aa7e3e6a0 (diff)
parent8e5c4c91faba6747682339ed7af95a1227d2f1b4 (diff)
downloadnextcloud-server-2685129184472a308a3ba7730207816151b0ffd7.tar.gz
nextcloud-server-2685129184472a308a3ba7730207816151b0ffd7.zip
Merge pull request #1188 from nextcloud/2fa-redirect-default-app
redirect to default app after solving the 2FA challenge
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
index 08d8dd1452c..28f16241e2f 100644
--- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php
+++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
@@ -39,13 +39,13 @@ class TwoFactorChallengeControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->request = $this->getMock('\OCP\IRequest');
+ $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
$this->twoFactorManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMock('\OCP\IUserSession');
- $this->session = $this->getMock('\OCP\ISession');
- $this->urlGenerator = $this->getMock('\OCP\IURLGenerator');
+ $this->userSession = $this->getMockBuilder('\OCP\IUserSession')->getMock();
+ $this->session = $this->getMockBuilder('\OCP\ISession')->getMock();
+ $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->getMock();
$this->controller = $this->getMockBuilder('OC\Core\Controller\TwoFactorChallengeController')
->setConstructorArgs([
@@ -64,7 +64,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
}
public function testSelectChallenge() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$providers = [
'prov1',
'prov2',
@@ -88,7 +88,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
}
public function testShowChallenge() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$provider = $this->getMockBuilder('\OCP\Authentication\TwoFactorAuth\IProvider')
->disableOriginalConstructor()
->getMock();
@@ -130,7 +130,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
}
public function testShowInvalidChallenge() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userSession->expects($this->once())
->method('getUser')
@@ -150,7 +150,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
}
public function testSolveChallenge() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$provider = $this->getMockBuilder('\OCP\Authentication\TwoFactorAuth\IProvider')
->disableOriginalConstructor()
->getMock();
@@ -167,17 +167,13 @@ class TwoFactorChallengeControllerTest extends TestCase {
->method('verifyChallenge')
->with('myprovider', $user, 'token')
->will($this->returnValue(true));
- $this->urlGenerator->expects($this->once())
- ->method('linkToRoute')
- ->with('files.view.index')
- ->will($this->returnValue('files/index/url'));
- $expected = new \OCP\AppFramework\Http\RedirectResponse('files/index/url');
+ $expected = new \OCP\AppFramework\Http\RedirectResponse(\OC_Util::getDefaultPageUrl());
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
}
public function testSolveChallengeInvalidProvider() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userSession->expects($this->once())
->method('getUser')
@@ -197,7 +193,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
}
public function testSolveInvalidChallenge() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$provider = $this->getMockBuilder('\OCP\Authentication\TwoFactorAuth\IProvider')
->disableOriginalConstructor()
->getMock();