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:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2022-07-22 23:15:08 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2022-07-22 23:15:41 +0300
commitb3b6f2d581bb3aeae0bd9121261d003c173b2bd6 (patch)
tree821ac620bb0553f31e89957f972aa54d97a7226c /tests
parent6f0ae0b95f8514ca441113bf2362d7d43f679238 (diff)
fix Controller tests
- added pageTitle in code was missing in expectations - fixed warnings of superflouos parameter - fixed wrong type of mock Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/AvatarControllerTest.php5
-rw-r--r--tests/Core/Controller/LoginControllerTest.php16
2 files changed, 13 insertions, 8 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index 5c0814dbf86..256f5665795 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -38,6 +38,7 @@ use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
+use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IAvatar;
use OCP\IAvatarManager;
use OCP\ICache;
@@ -59,7 +60,7 @@ class AvatarControllerTest extends \Test\TestCase {
private $avatarMock;
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
private $userMock;
- /** @var File|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var ISimpleFile|\PHPUnit\Framework\MockObject\MockObject */
private $avatarFile;
/** @var IAvatarManager|\PHPUnit\Framework\MockObject\MockObject */
@@ -115,7 +116,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->userManager->method('get')
->willReturnMap([['userId', $this->userMock]]);
- $this->avatarFile = $this->getMockBuilder('OCP\Files\File')->getMock();
+ $this->avatarFile = $this->getMockBuilder(ISimpleFile::class)->getMock();
$this->avatarFile->method('getContent')->willReturn('image data');
$this->avatarFile->method('getMimeType')->willReturn('image type');
$this->avatarFile->method('getEtag')->willReturn('my etag');
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 551e8917482..cee3da65994 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -228,7 +228,7 @@ class LoginControllerTest extends TestCase {
->willReturn('/default/foo');
$expectedResponse = new RedirectResponse('/default/foo');
- $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', ''));
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', ''));
}
public function testShowLoginFormWithErrorsInSession() {
@@ -279,10 +279,11 @@ class LoginControllerTest extends TestCase {
'login',
[
'alt_login' => [],
+ 'pageTitle' => 'Login'
],
'guest'
);
- $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', ''));
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', ''));
}
public function testShowLoginFormForFlowAuth() {
@@ -303,16 +304,17 @@ class LoginControllerTest extends TestCase {
'login',
[
'alt_login' => [],
+ 'pageTitle' => 'Login'
],
'guest'
);
- $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', 'login/flow', ''));
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', 'login/flow'));
}
/**
* @return array
*/
- public function passwordResetDataProvider() {
+ public function passwordResetDataProvider(): array {
return [
[
true,
@@ -371,10 +373,11 @@ class LoginControllerTest extends TestCase {
'login',
[
'alt_login' => [],
+ 'pageTitle' => 'Login'
],
'guest'
);
- $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('LdapUser', '', ''));
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('LdapUser', ''));
}
public function testShowLoginFormForUserNamed0() {
@@ -425,10 +428,11 @@ class LoginControllerTest extends TestCase {
'login',
[
'alt_login' => [],
+ 'pageTitle' => 'Login'
],
'guest'
);
- $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('0', '', ''));
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('0', ''));
}
public function testLoginWithInvalidCredentials() {