From 16587965e9a95ec62de311d1781b3881ca0008e7 Mon Sep 17 00:00:00 2001 From: sanaullahkhan Date: Fri, 2 Feb 2024 10:11:42 +0000 Subject: [PATCH] test(refactor): TestCase reverted to MockeryTestCase --- .../Olcs/src/Controller/Auth/LoginControllerTest.php | 12 +++++++----- .../Licence/Vehicle/ListVehicleControllerTest.php | 4 ++-- .../Licence/Vehicle/SwitchBoardControllerTest.php | 4 ++-- .../src/Controller/SessionTimeoutControllerTest.php | 6 +++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/test/Olcs/src/Controller/Auth/LoginControllerTest.php b/test/Olcs/src/Controller/Auth/LoginControllerTest.php index e773b6994..b5e0983dd 100644 --- a/test/Olcs/src/Controller/Auth/LoginControllerTest.php +++ b/test/Olcs/src/Controller/Auth/LoginControllerTest.php @@ -1,4 +1,5 @@ flashMessengerMock->expects('addMessage') + ->times(2) ->withAnyArgs(); // Execute @@ -517,7 +519,7 @@ public function postAction_FailedAuthentication_FlashesInvalidUsernameOrPassword $this->redirectHelperMock->allows()->toRoute(LoginController::ROUTE_AUTH_LOGIN_GET)->andReturn($this->redirect()); // Expect - $this->flashMessengerMock->expects('addMessage')->withAnyArgs(); + $this->flashMessengerMock->expects('addMessage')->times(2)->withAnyArgs(); // Execute $this->sut->postAction($request, new RouteMatch([]), new Response()); @@ -541,7 +543,7 @@ public function postAction_FailedAuthentication_FlashesInvalidUsernameOrPassword $this->redirectHelperMock->allows()->toRoute(LoginController::ROUTE_AUTH_LOGIN_GET)->andReturn($this->redirect()); // Expect - $this->flashMessengerMock->expects('addMessage')->withAnyArgs(); + $this->flashMessengerMock->expects('addMessage')->times(2)->withAnyArgs(); // Execute $this->sut->postAction($request, new RouteMatch([]), new Response()); @@ -565,7 +567,7 @@ public function postAction_FailedAuthentication_FlashesAccountDisabledWhenAuthen $this->redirectHelperMock->allows()->toRoute(LoginController::ROUTE_AUTH_LOGIN_GET)->andReturn($this->redirect()); // Expect - $this->flashMessengerMock->expects('addMessage')->withAnyArgs(); + $this->flashMessengerMock->expects('addMessage')->times(2)->withAnyArgs(); // Execute $this->sut->postAction($request, new RouteMatch([]), new Response()); diff --git a/test/Olcs/src/Controller/Licence/Vehicle/ListVehicleControllerTest.php b/test/Olcs/src/Controller/Licence/Vehicle/ListVehicleControllerTest.php index b013b667c..e61b9d796 100644 --- a/test/Olcs/src/Controller/Licence/Vehicle/ListVehicleControllerTest.php +++ b/test/Olcs/src/Controller/Licence/Vehicle/ListVehicleControllerTest.php @@ -37,16 +37,16 @@ use Laminas\Validator\Translator\TranslatorInterface; use Laminas\View\Model\ViewModel; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; use Olcs\Controller\Licence\Vehicle\ListVehicleController; use Olcs\Form\Model\Form\Vehicle\ListVehicleSearch; use Olcs\Table\TableEnum; -use PHPUnit\Framework\TestCase; /** * @see ListVehicleController */ -class ListVehicleControllerTest extends TestCase +class ListVehicleControllerTest extends MockeryTestCase { protected const ROUTE_CONFIGURATION_FOR_LICENCE_WITH_REMOVED_VEHICLES_SHOWING_AND_FOCUSED = [ 'licence/vehicle/list/GET', diff --git a/test/Olcs/src/Controller/Licence/Vehicle/SwitchBoardControllerTest.php b/test/Olcs/src/Controller/Licence/Vehicle/SwitchBoardControllerTest.php index 1edeb4323..17de3e1a6 100644 --- a/test/Olcs/src/Controller/Licence/Vehicle/SwitchBoardControllerTest.php +++ b/test/Olcs/src/Controller/Licence/Vehicle/SwitchBoardControllerTest.php @@ -25,14 +25,14 @@ use Laminas\Stdlib\Parameters; use Laminas\View\Model\ViewModel; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; use Olcs\Controller\Licence\Vehicle\ListVehicleController; use Olcs\Controller\Licence\Vehicle\SwitchBoardController; use Olcs\Form\Model\Form\Vehicle\SwitchBoard; use Olcs\Session\LicenceVehicleManagement; -use PHPUnit\Framework\TestCase; -class SwitchBoardControllerTest extends TestCase +class SwitchBoardControllerTest extends MockeryTestCase { /** * @var FlashMessenger diff --git a/test/Olcs/src/Controller/SessionTimeoutControllerTest.php b/test/Olcs/src/Controller/SessionTimeoutControllerTest.php index 369520341..0cc8b038c 100644 --- a/test/Olcs/src/Controller/SessionTimeoutControllerTest.php +++ b/test/Olcs/src/Controller/SessionTimeoutControllerTest.php @@ -17,20 +17,20 @@ use Laminas\Uri\Http; use Laminas\View\Model\ViewModel; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use Olcs\Controller\SessionTimeoutController; use LmcRbacMvc\Identity\IdentityProviderInterface; -use PHPUnit\Framework\TestCase; /** * @see SessionTimeoutController */ -class SessionTimeoutControllerTest extends TestCase +class SessionTimeoutControllerTest extends MockeryTestCase { protected const COOKIE_NAME = 'cookie'; private $identityProviderClass = JWTIdentityProvider::class; private IdentityProviderInterface $identityProviderMock; protected Redirect $redirectHelperMock; - protected SessionTimeoutController $sut; + protected SessionTimeoutController $sut; /** * @test