summaryrefslogtreecommitdiffstats
path: root/tests/Core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/ChangePasswordControllerTest.php4
-rw-r--r--tests/Core/Controller/OCSControllerTest.php6
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php17
-rw-r--r--tests/Core/Templates/TemplatesTest.php20
4 files changed, 16 insertions, 31 deletions
diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php
index c426bae9974..ea3abb58e2f 100644
--- a/tests/Core/Controller/ChangePasswordControllerTest.php
+++ b/tests/Core/Controller/ChangePasswordControllerTest.php
@@ -50,9 +50,9 @@ class ChangePasswordControllerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->userManager = $this->createMock(IUserManager::class);
+ $this->userManager = $this->createMock(\OC\User\Manager::class);
$this->userSession = $this->createMock(Session::class);
- $this->groupManager = $this->createMock(IGroupManager::class);
+ $this->groupManager = $this->createMock(\OC\Group\Manager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')->will($this->returnArgument(0));
diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php
index 9d0a3dae118..aa2c780f82e 100644
--- a/tests/Core/Controller/OCSControllerTest.php
+++ b/tests/Core/Controller/OCSControllerTest.php
@@ -169,7 +169,7 @@ class OCSControllerTest extends TestCase {
$this->equalTo('wrongpass')
)->willReturn(false);
- $expected = new DataResponse(null, 102);
+ $expected = new DataResponse([], 102);
$expected->throttle();
$this->assertEquals($expected, $this->controller->personCheck('user', 'wrongpass'));
}
@@ -181,7 +181,7 @@ class OCSControllerTest extends TestCase {
$this->equalTo('wrongpass')
)->willReturn(false);
- $expected = new DataResponse(null, 101);
+ $expected = new DataResponse([], 101);
$this->assertEquals($expected, $this->controller->personCheck('', ''));
}
@@ -192,7 +192,7 @@ class OCSControllerTest extends TestCase {
->with('NotExistingUser')
->willReturn(null);
- $expected = new DataResponse('User not found', 404);
+ $expected = new DataResponse(['User not found'], 404);
$this->assertEquals($expected, $this->controller->getIdentityProof('NotExistingUser'));
}
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));
}
}
diff --git a/tests/Core/Templates/TemplatesTest.php b/tests/Core/Templates/TemplatesTest.php
deleted file mode 100644
index cd1502fd22c..00000000000
--- a/tests/Core/Templates/TemplatesTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace Tests\Core\Templates;
-
-class TemplatesTest extends \Test\TestCase {
-
- public function test403() {
- $template = \OC::$SERVERROOT . '/core/templates/403.php';
- $expectedHtml = "<ul><li class='error'>\n\t\tAccess forbidden<br><p class='hint'></p></li></ul>";
- $this->assertTemplate($expectedHtml, $template);
- }
-
- public function test404() {
- $template = \OC::$SERVERROOT . '/core/templates/404.php';
- $href = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
- $expectedHtml = "<ul><li class='error'>\n\t\t\tFile not found<br><p class='hint'>The specified document has not been found on the server.</p>\n<p class='hint'><a href='$href'>You can click here to return to Nextcloud.</a></p>\n\t\t</li></ul>";
- $this->assertTemplate($expectedHtml, $template);
- }
-
-}