Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

test(refactored): Vol 4817 #38

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
57b0235
test(refactor): Change to ContainerInterface from ServiceManager
sanakhandvsa Jan 18, 2024
7151117
test(refactor): Change to ContainerInterface from ServiceManager for …
sanakhandvsa Jan 18, 2024
30e2cf3
test(refactor): Change to ContainerInterface from ServiceManager for …
sanakhandvsa Jan 18, 2024
d75e78b
test(refactor): default setup and indexAction_ReturnsViewModel test r…
sanakhandvsa Jan 19, 2024
35d1ad7
test(refactor): refactored updated createLoginController as helper fu…
sanakhandvsa Jan 19, 2024
37a12dc
test(refactor): refactoring postAction test
sanakhandvsa Jan 22, 2024
5f25133
test(refactor): few test refactored according to phpunit mock test
sanakhandvsa Jan 23, 2024
ce28e30
test(refactor): All test on LoginController passed
sanakhandvsa Jan 23, 2024
f192147
test(refactor): unused namespace and method removed
sanakhandvsa Jan 23, 2024
7457176
test(refactor): SwitchBoardControllerTest intial workflow setup and h…
sanakhandvsa Jan 24, 2024
3e92be1
test(refactor): ReturnsViewModel_WithPanel_WhenFlashMessageHasPanelNa…
sanakhandvsa Jan 24, 2024
ea0cf1b
test(refactor): Other test refactored
sanakhandvsa Jan 25, 2024
1797f3f
test(refactor): Other test refactored and unwanted files removed
sanakhandvsa Jan 25, 2024
268c083
test(refactor): Removed MockServicetrait, mocktestcase and added defa…
sanakhandvsa Jan 25, 2024
6f7175c
test(refactor): Added dependencies injection to the setup
sanakhandvsa Jan 26, 2024
2932ec7
test(refactor): Added dependencies injection to the setup
sanakhandvsa Jan 26, 2024
a6fddee
test(refactor): Added dependencies injection to the setup
sanakhandvsa Jan 26, 2024
7dd60fb
test(refactor): refactored tests
sanakhandvsa Jan 27, 2024
011b5ad
test(refactor): refactored tests
sanakhandvsa Jan 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 15 additions & 28 deletions test/Olcs/src/Controller/Auth/LoginControllerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,19 @@
use Dvsa\Olcs\Auth\Service\Auth\CookieService;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\Mvc\Controller\Plugin\Url;
use Laminas\ServiceManager\ServiceManager;
use Olcs\Auth\Adapter\SelfserveCommandAdapter;
use Olcs\Controller\Auth\LoginController;
use Olcs\Controller\Auth\LoginControllerFactory;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use Common\Test\MocksServicesTrait;
use Mockery as m;
use PHPUnit\Framework\TestCase;

class LoginControllerFactoryTest extends MockeryTestCase
class LoginControllerFactoryTest extends TestCase
{
use MocksServicesTrait;

/**
* @var LoginControllerFactory
*/
protected $sut;

public function setUp(): void
{
$this->setUpServiceManager();
}

/**
* @test
*/
Expand All @@ -51,11 +42,22 @@ public function __invoke_IsCallable(): void
*/
public function __invoke_ReturnsAnInstanceOfDispatcherWithLoginController()
{
// Setup
$this->setUpSut();
$serviceManager = $this->createMock(\Interop\Container\ContainerInterface::class);
$serviceManager->method('get')->willReturnMap([
[SelfserveCommandAdapter::class, $this->createMock(SelfserveCommandAdapter::class)],
[AuthenticationServiceInterface::class , $this->createMock(AuthenticationServiceInterface::class)],
['Auth\CookieService', $this->createMock(CookieService::class)],
[CurrentUser::class, $this->createMock(CurrentUser::class)],
[FlashMessenger::class, $this->createMock(FlashMessenger::class)],
[FormHelperService::class, $this->createMock(FormHelperService::class)],
[Redirect::class, $this->createMock(Redirect::class)],
[Url::class, $this->createMock(Url::class)],
['ControllerPluginManager', $serviceManager]
]);

// Execute
$result = $this->sut->__invoke($this->serviceManager(), null);
$result = $this->sut->__invoke($serviceManager, null);

// Assert
$this->assertInstanceOf(Dispatcher::class, $result);
Expand All @@ -66,19 +68,4 @@ protected function setUpSut(): void
{
$this->sut = new LoginControllerFactory();
}

/**
* @param ServiceManager $serviceManager
*/
protected function setUpDefaultServices(ServiceManager $serviceManager)
{
$serviceManager->setService(SelfserveCommandAdapter::class, $this->setUpMockService(SelfserveCommandAdapter::class));
$serviceManager->setService(AuthenticationServiceInterface::class, $this->setUpMockService(AuthenticationServiceInterface::class));
$serviceManager->setService('Auth\CookieService', $this->setUpMockService(CookieService::class));
$serviceManager->setService(CurrentUser::class, $this->setUpMockService(CurrentUser::class));
$serviceManager->setService(FlashMessenger::class, $this->setUpMockService(FlashMessenger::class));
$serviceManager->setService(FormHelperService::class, $this->setUpMockService(FormHelperService::class));
$serviceManager->setService(Redirect::class, $this->setUpMockService(Redirect::class));
$serviceManager->setService(Url::class, $this->setUpMockService(Url::class));
}
}
Loading
Loading