summaryrefslogtreecommitdiffstats
path: root/tests/Core/Middleware/TwoFactorMiddlewareTest.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-07-26 10:50:39 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-07-31 16:54:19 +0200
commitf71dc7523f7625da4c47ec9d5b116d20f71dba33 (patch)
treed8992481a5f8b043ac010986fed8eb7eaf3ce3db /tests/Core/Middleware/TwoFactorMiddlewareTest.php
parent3548603a88360f9577a386c3b9c2032230c48632 (diff)
downloadnextcloud-server-f71dc7523f7625da4c47ec9d5b116d20f71dba33.tar.gz
nextcloud-server-f71dc7523f7625da4c47ec9d5b116d20f71dba33.zip
Fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/Core/Middleware/TwoFactorMiddlewareTest.php')
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index fc8cf0d8b7e..56022c78bdd 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -24,6 +24,7 @@ namespace Test\Core\Middleware;
use OC\Core\Middleware\TwoFactorMiddleware;
use OC\AppFramework\Http\Request;
+use OCP\AppFramework\Controller;
use OCP\AppFramework\Utility\IControllerMethodReflector;
use OCP\IConfig;
use OCP\ISession;
@@ -44,6 +45,9 @@ class TwoFactorMiddlewareTest extends TestCase {
/** @var TwoFactorMiddleware */
private $middleware;
+ /** @var Controller */
+ private $controller;
+
protected function setUp() {
parent::setUp();
@@ -67,6 +71,7 @@ class TwoFactorMiddlewareTest extends TestCase {
);
$this->middleware = new TwoFactorMiddleware($this->twoFactorManager, $this->userSession, $this->session, $this->urlGenerator, $this->reflector, $this->request);
+ $this->controller = $this->createMock(Controller::class);
}
public function testBeforeControllerNotLoggedIn() {
@@ -81,7 +86,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->userSession->expects($this->never())
->method('getUser');
- $this->middleware->beforeController(null, 'index');
+ $this->middleware->beforeController($this->controller, 'index');
}
public function testBeforeControllerPublicPage() {
@@ -92,7 +97,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->userSession->expects($this->never())
->method('isLoggedIn');
- $this->middleware->beforeController(null, 'create');
+ $this->middleware->beforeController($this->controller, 'create');
}
public function testBeforeControllerNoTwoFactorCheckNeeded() {
@@ -113,7 +118,7 @@ class TwoFactorMiddlewareTest extends TestCase {
->with($user)
->will($this->returnValue(false));
- $this->middleware->beforeController(null, 'index');
+ $this->middleware->beforeController($this->controller, 'index');
}
/**
@@ -141,7 +146,7 @@ class TwoFactorMiddlewareTest extends TestCase {
->with($user)
->will($this->returnValue(true));
- $this->middleware->beforeController(null, 'index');
+ $this->middleware->beforeController($this->controller, 'index');
}
/**
@@ -184,7 +189,7 @@ class TwoFactorMiddlewareTest extends TestCase {
->will($this->returnValue('test/url'));
$expected = new \OCP\AppFramework\Http\RedirectResponse('test/url');
- $this->assertEquals($expected, $this->middleware->afterException(null, 'index', $ex));
+ $this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
}
public function testAfterException() {
@@ -196,7 +201,7 @@ class TwoFactorMiddlewareTest extends TestCase {
->will($this->returnValue('redirect/url'));
$expected = new \OCP\AppFramework\Http\RedirectResponse('redirect/url');
- $this->assertEquals($expected, $this->middleware->afterException(null, 'index', $ex));
+ $this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
}
}