Skip to content

Commit

Permalink
chore: update logincontroller tests
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
  • Loading branch information
emoral435 committed Mar 10, 2024
1 parent 182342d commit 6851457
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/Core/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OC\Authentication\TwoFactorAuth\Manager;
use OC\Core\Controller\LoginController;
use OC\User\Session;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Defaults;
Expand Down Expand Up @@ -89,6 +90,9 @@ class LoginControllerTest extends TestCase {
/** @var IL10N|MockObject */
private $l;

/** @var IAppManager|MockObject */
private $appManager;

protected function setUp(): void {
parent::setUp();
$this->request = $this->createMock(IRequest::class);
Expand All @@ -104,6 +108,8 @@ protected function setUp(): void {
$this->webAuthnManager = $this->createMock(\OC\Authentication\WebAuthn\Manager::class);
$this->notificationManager = $this->createMock(IManager::class);
$this->l = $this->createMock(IL10N::class);
$this->appManager = $this->createMock(IAppManager::class);

$this->l->expects($this->any())
->method('t')
->willReturnCallback(function ($text, $parameters = []) {
Expand Down Expand Up @@ -132,7 +138,8 @@ protected function setUp(): void {
$this->initialStateService,
$this->webAuthnManager,
$this->notificationManager,
$this->l
$this->l,
$this->appManager,
);
}

Expand Down Expand Up @@ -258,7 +265,7 @@ public function testShowLoginFormWithErrorsInSession() {
],
]
);
$this->initialStateService->expects($this->exactly(11))
$this->initialStateService->expects($this->exactly(12))
->method('provideInitialState')
->withConsecutive([
'core',
Expand Down Expand Up @@ -300,7 +307,7 @@ public function testShowLoginFormForFlowAuth() {
->expects($this->once())
->method('isLoggedIn')
->willReturn(false);
$this->initialStateService->expects($this->exactly(12))
$this->initialStateService->expects($this->exactly(13))
->method('provideInitialState')
->withConsecutive([], [], [], [
'core',
Expand Down Expand Up @@ -371,7 +378,7 @@ public function testShowLoginFormWithPasswordResetOption($canChangePassword,
->method('get')
->with('LdapUser')
->willReturn($user);
$this->initialStateService->expects($this->exactly(11))
$this->initialStateService->expects($this->exactly(12))
->method('provideInitialState')
->withConsecutive([], [], [
'core',
Expand Down Expand Up @@ -421,7 +428,7 @@ public function testShowLoginFormForUserNamed0() {
->method('get')
->with('0')
->willReturn($user);
$this->initialStateService->expects($this->exactly(11))
$this->initialStateService->expects($this->exactly(12))
->method('provideInitialState')
->withConsecutive([], [], [], [
'core',
Expand Down

0 comments on commit 6851457

Please sign in to comment.