summaryrefslogtreecommitdiffstats
path: root/tests/Core/Middleware
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-09-02 11:04:29 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-09-06 09:29:27 +0200
commit3a3a17b2e33351b82d987c2f82016a1a85eb2aed (patch)
tree6ea21525575cfd9a6cfc25a4e3eb819619cb31bc /tests/Core/Middleware
parent5fb2eee5df6bfbe3d608709fbe6997860fe4d648 (diff)
downloadnextcloud-server-3a3a17b2e33351b82d987c2f82016a1a85eb2aed.tar.gz
nextcloud-server-3a3a17b2e33351b82d987c2f82016a1a85eb2aed.zip
Fix getMock TwoFactorMiddlewareTest
Diffstat (limited to 'tests/Core/Middleware')
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 8247efa1b82..fc8cf0d8b7e 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -24,6 +24,12 @@ namespace Test\Core\Middleware;
use OC\Core\Middleware\TwoFactorMiddleware;
use OC\AppFramework\Http\Request;
+use OCP\AppFramework\Utility\IControllerMethodReflector;
+use OCP\IConfig;
+use OCP\ISession;
+use OCP\IURLGenerator;
+use OCP\IUser;
+use OCP\Security\ISecureRandom;
use Test\TestCase;
class TwoFactorMiddlewareTest extends TestCase {
@@ -47,17 +53,17 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->userSession = $this->getMockBuilder('\OC\User\Session')
->disableOriginalConstructor()
->getMock();
- $this->session = $this->getMock('\OCP\ISession');
- $this->urlGenerator = $this->getMock('\OCP\IURLGenerator');
- $this->reflector = $this->getMock('\OCP\AppFramework\Utility\IControllerMethodReflector');
+ $this->session = $this->createMock(ISession::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->reflector = $this->createMock(IControllerMethodReflector::class);
$this->request = new Request(
[
'server' => [
'REQUEST_URI' => 'test/url'
]
],
- $this->getMock('\OCP\Security\ISecureRandom'),
- $this->getMock('\OCP\IConfig')
+ $this->createMock(ISecureRandom::class),
+ $this->createMock(IConfig::class)
);
$this->middleware = new TwoFactorMiddleware($this->twoFactorManager, $this->userSession, $this->session, $this->urlGenerator, $this->reflector, $this->request);
@@ -90,7 +96,7 @@ class TwoFactorMiddlewareTest extends TestCase {
}
public function testBeforeControllerNoTwoFactorCheckNeeded() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$this->reflector->expects($this->once())
->method('hasAnnotation')
@@ -114,7 +120,7 @@ class TwoFactorMiddlewareTest extends TestCase {
* @expectedException \OC\Authentication\Exceptions\TwoFactorAuthRequiredException
*/
public function testBeforeControllerTwoFactorAuthRequired() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$this->reflector->expects($this->once())
->method('hasAnnotation')
@@ -142,7 +148,7 @@ class TwoFactorMiddlewareTest extends TestCase {
* @expectedException \OC\Authentication\Exceptions\UserAlreadyLoggedInException
*/
public function testBeforeControllerUserAlreadyLoggedIn() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$this->reflector->expects($this->once())
->method('hasAnnotation')