diff --git a/src/Application/Regulation/Query/GetRegulationsQuery.php b/src/Application/Regulation/Query/GetRegulationsQuery.php index bb30451a2..61c776b23 100644 --- a/src/Application/Regulation/Query/GetRegulationsQuery.php +++ b/src/Application/Regulation/Query/GetRegulationsQuery.php @@ -11,7 +11,6 @@ public function __construct( public int $pageSize, public int $page, - public bool $isPermanent, public ?array $organizationUuids = null, ) { } diff --git a/src/Application/Regulation/Query/GetRegulationsQueryHandler.php b/src/Application/Regulation/Query/GetRegulationsQueryHandler.php index 7f4904927..dab99c853 100644 --- a/src/Application/Regulation/Query/GetRegulationsQueryHandler.php +++ b/src/Application/Regulation/Query/GetRegulationsQueryHandler.php @@ -24,7 +24,6 @@ public function __invoke(GetRegulationsQuery $query): Pagination $rows = $this->repository->findAllRegulations( $query->pageSize, $query->page, - $query->isPermanent, $query->organizationUuids, ); diff --git a/src/Domain/Regulation/Repository/RegulationOrderRecordRepositoryInterface.php b/src/Domain/Regulation/Repository/RegulationOrderRecordRepositoryInterface.php index f107ed792..882245f55 100644 --- a/src/Domain/Regulation/Repository/RegulationOrderRecordRepositoryInterface.php +++ b/src/Domain/Regulation/Repository/RegulationOrderRecordRepositoryInterface.php @@ -18,7 +18,6 @@ public function findOneUuidByIdentifierInOrganization(string $identifier, Organi public function findAllRegulations( int $maxItemsPerPage, int $page, - bool $isPermanent, ?array $organizationUuids = null, ): array; diff --git a/src/Infrastructure/Controller/Regulation/DeleteRegulationController.php b/src/Infrastructure/Controller/Regulation/DeleteRegulationController.php index 6111e9276..737cb0eba 100644 --- a/src/Infrastructure/Controller/Regulation/DeleteRegulationController.php +++ b/src/Infrastructure/Controller/Regulation/DeleteRegulationController.php @@ -58,16 +58,11 @@ public function __invoke(Request $request, string $uuid): Response // The regulation may have been deleted before. // Don't fail, as DELETE is an idempotent method (see RFC 9110, 9.2.2). return new RedirectResponse( - url: $this->router->generate('app_regulations_list', [ - 'tab' => 'temporary', - ]), + url: $this->router->generate('app_regulations_list'), status: Response::HTTP_SEE_OTHER, ); } - // Get before the entity gets deleted. - $endDate = $regulationOrderRecord->getRegulationOrder()->getEndDate(); - try { $this->commandBus->handle(new DeleteRegulationCommand($user->getOrganizationUuids(), $regulationOrderRecord)); } catch (RegulationOrderRecordCannotBeDeletedException) { @@ -75,9 +70,7 @@ public function __invoke(Request $request, string $uuid): Response } return new RedirectResponse( - url: $this->router->generate('app_regulations_list', [ - 'tab' => $endDate ? 'temporary' : 'permanent', - ]), + url: $this->router->generate('app_regulations_list'), status: Response::HTTP_SEE_OTHER, ); } diff --git a/src/Infrastructure/Controller/Regulation/ListRegulationsController.php b/src/Infrastructure/Controller/Regulation/ListRegulationsController.php index a5f8e5922..8fdcfac5a 100644 --- a/src/Infrastructure/Controller/Regulation/ListRegulationsController.php +++ b/src/Infrastructure/Controller/Regulation/ListRegulationsController.php @@ -34,7 +34,6 @@ public function __invoke(Request $request): Response { /** @var SymfonyUser|null */ $user = $this->security->getUser(); - $tab = $request->query->get('tab', 'temporary'); $pageSize = min($request->query->getInt('pageSize', 20), 100); $page = $request->query->getInt('page', 1); @@ -46,19 +45,10 @@ public function __invoke(Request $request): Response $organizationUserUuids = $user?->getOrganizationUuids(); - $temporaryRegulations = $this->queryBus->handle( + $regulations = $this->queryBus->handle( new GetRegulationsQuery( pageSize: $pageSize, - page: $tab === 'temporary' ? $page : 1, - isPermanent: false, - organizationUuids: $organizationUserUuids, - ), - ); - $permanentRegulations = $this->queryBus->handle( - new GetRegulationsQuery( - pageSize: $pageSize, - page: $tab === 'permanent' ? $page : 1, - isPermanent: true, + page: $page, organizationUuids: $organizationUserUuids, ), ); @@ -66,9 +56,7 @@ public function __invoke(Request $request): Response return new Response($this->twig->render( name: 'regulation/index.html.twig', context: [ - 'temporaryRegulations' => $temporaryRegulations, - 'permanentRegulations' => $permanentRegulations, - 'tab' => $tab, + 'regulations' => $regulations, 'pageSize' => $pageSize, 'page' => $page, ], diff --git a/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php index 7a7a48456..10b148329 100644 --- a/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php +++ b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php @@ -12,8 +12,6 @@ final class RegulationOrderFixture extends Fixture { public const TYPICAL_IDENTIFIER = 'FO1/2023'; - public const NUM_TEMPORARY = 9; - public const NUM_PERMANENT = 1; public const IDENTIFIER_CIFS = 'F/CIFS/2023'; public function load(ObjectManager $manager): void diff --git a/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderRecordRepository.php b/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderRecordRepository.php index 6f266aaa6..1a72772a6 100644 --- a/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderRecordRepository.php +++ b/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderRecordRepository.php @@ -56,7 +56,6 @@ public function __construct( public function findAllRegulations( int $maxItemsPerPage, int $page, - bool $isPermanent, ?array $organizationUuids = null, ): array { $query = $this->createQueryBuilder('roc') @@ -83,7 +82,7 @@ public function findAllRegulations( $query ->innerJoin('roc.organization', 'o') - ->innerJoin('roc.regulationOrder', 'ro', 'WITH', $isPermanent ? 'ro.endDate IS NULL' : 'ro.endDate IS NOT NULL') + ->innerJoin('roc.regulationOrder', 'ro') ->orderBy('ro.startDate', 'DESC') ->addOrderBy('ro.identifier', 'ASC') ->addGroupBy('ro, roc, o') diff --git a/templates/regulation/_items.html.twig b/templates/regulation/_items.html.twig index 3cba0b713..efca5a7db 100644 --- a/templates/regulation/_items.html.twig +++ b/templates/regulation/_items.html.twig @@ -16,7 +16,7 @@ {{ 'regulation.organization'|trans }} {{ 'regulation.locations'|trans }} {{ 'regulation.period'|trans }} - {{ 'regulation.status'|trans }} + {{ 'regulation.status'|trans }} {{ 'common.actions'|trans }} diff --git a/templates/regulation/detail.html.twig b/templates/regulation/detail.html.twig index 9a99c1d30..14441753c 100644 --- a/templates/regulation/detail.html.twig +++ b/templates/regulation/detail.html.twig @@ -114,8 +114,7 @@
- {% set tab = generalInfo.startDate and generalInfo.endDate ? 'temporary' : 'permanent' %} - + {{ 'regulation.back'|trans }}
diff --git a/templates/regulation/index.html.twig b/templates/regulation/index.html.twig index d688c417e..ff33a5687 100644 --- a/templates/regulation/index.html.twig +++ b/templates/regulation/index.html.twig @@ -6,8 +6,6 @@ {% block body %}
- {% set isTemporaryTab = tab == 'temporary' %} - {% set isPermanent = tab == 'permanent' %}

{{ 'regulation.list.title'|trans }}

{% if app.user %} @@ -16,47 +14,13 @@ {% endif %}
-
- -
- {% include "regulation/_items.html.twig" with { pagination: temporaryRegulations } only %} - {% include "common/pagination.html.twig" with { - pagination: temporaryRegulations, - currentPage: isTemporaryTab ? app.request.get('page', 1) : 1, - queryParams: app.request.query.all|merge({ tab: 'temporary' }), - } only %} -
-
- {% include "regulation/_items.html.twig" with { pagination: permanentRegulations } only %} - {% include "common/pagination.html.twig" with { - pagination: permanentRegulations, - currentPage: isPermanent ? app.request.get('page', 1) : 1, - queryParams: app.request.query.all|merge({ tab: 'permanent' }), - } only %} -
+
+ {% include "regulation/_items.html.twig" with { pagination: regulations } only %} + {% include "common/pagination.html.twig" with { + pagination: regulations, + currentPage: app.request.get('page', 1), + queryParams: app.request.query.all(), + } only %}
{% endblock %} diff --git a/tests/Integration/Infrastructure/Controller/Regulation/DeleteRegulationControllerTest.php b/tests/Integration/Infrastructure/Controller/Regulation/DeleteRegulationControllerTest.php index 6133518e6..090c95d0e 100644 --- a/tests/Integration/Infrastructure/Controller/Regulation/DeleteRegulationControllerTest.php +++ b/tests/Integration/Infrastructure/Controller/Regulation/DeleteRegulationControllerTest.php @@ -13,52 +13,27 @@ final class DeleteRegulationControllerTest extends AbstractWebTestCase { use SessionHelper; - private function countRows($crawler) + private function countRows($crawler): int { - $numTemporary = $crawler->filter('#temporary-panel tbody > tr:not([data-testid=empty-row])')->count(); - $numPermanent = $crawler->filter('#permanent-panel tbody > tr:not([data-testid=empty-row])')->count(); + $num = $crawler->filter('.app-regulation-table tbody > tr:not([data-testid=empty-row])')->count(); - return [$numTemporary, $numPermanent]; + return $num; } - public function testDeleteTemporary(): void + public function testDelete(): void { $client = $this->login(); $crawler = $client->request('GET', '/regulations'); - [$numTemporary, $numPermanent] = $this->countRows($crawler); + $num = $this->countRows($crawler); $client->request('DELETE', '/regulations/' . RegulationOrderRecordFixture::UUID_TYPICAL, [ 'token' => $this->generateCsrfToken($client, 'delete-regulation'), ]); - $this->assertResponseRedirects('/regulations?tab=temporary', 303); + $this->assertResponseRedirects('/regulations', 303); $crawler = $client->followRedirect(); // Doesn't appear in list of temporary regulations anymore. - $this->assertEquals([$numTemporary - 1, $numPermanent], $this->countRows($crawler)); - } - - public function testDeletePermanent(): void - { - $client = $this->login(); - - $client->request('GET', '/regulations/' . RegulationOrderRecordFixture::UUID_PERMANENT); - $this->assertResponseStatusCodeSame(200); - - $crawler = $client->request('GET', '/regulations'); - [$numTemporary, $numPermanent] = $this->countRows($crawler); - - $client->request('DELETE', '/regulations/' . RegulationOrderRecordFixture::UUID_PERMANENT, [ - 'token' => $this->generateCsrfToken($client, 'delete-regulation'), - ]); - $this->assertResponseRedirects('/regulations?tab=permanent', 303); - $crawler = $client->followRedirect(); - - // Doesn't appear in list of permanent regulations anymore. - $this->assertSame([$numTemporary, $numPermanent - 1], $this->countRows($crawler), $crawler->html()); - - // Detail page doesn't exist anymore. - $client->request('GET', '/regulations/' . RegulationOrderRecordFixture::UUID_PERMANENT); - $this->assertResponseStatusCodeSame(404); + $this->assertEquals($num - 1, $this->countRows($crawler)); } public function testCannotDeleteBecauseDifferentOrganization(): void @@ -76,7 +51,7 @@ public function testRegulationOrderRecordNotFound(): void $client->request('DELETE', '/regulations/' . RegulationOrderRecordFixture::UUID_DOES_NOT_EXIST, [ 'token' => $this->generateCsrfToken($client, 'delete-regulation'), ]); - $this->assertResponseRedirects('/regulations?tab=temporary', 303); + $this->assertResponseRedirects('/regulations', 303); } public function testInvalidCsrfToken(): void diff --git a/tests/Integration/Infrastructure/Controller/Regulation/ListRegulationsControllerTest.php b/tests/Integration/Infrastructure/Controller/Regulation/ListRegulationsControllerTest.php index b10a08087..dc040be58 100644 --- a/tests/Integration/Infrastructure/Controller/Regulation/ListRegulationsControllerTest.php +++ b/tests/Integration/Infrastructure/Controller/Regulation/ListRegulationsControllerTest.php @@ -4,17 +4,15 @@ namespace App\Tests\Integration\Infrastructure\Controller\Regulation; -use App\Infrastructure\Persistence\Doctrine\Fixtures\RegulationOrderFixture; use App\Infrastructure\Persistence\Doctrine\Fixtures\RegulationOrderRecordFixture; -use App\Infrastructure\Persistence\Doctrine\Fixtures\UserFixture; use App\Tests\Integration\Infrastructure\Controller\AbstractWebTestCase; final class ListRegulationsControllerTest extends AbstractWebTestCase { - public function testPageAndTabs(): void + public function testNavAndPagination(): void { $client = $this->login(); - $crawler = $client->request('GET', '/regulations'); + $crawler = $client->request('GET', '/regulations?pageSize=1&page=1'); $this->assertResponseStatusCodeSame(200); $this->assertSecurityHeaders(); @@ -28,62 +26,69 @@ public function testPageAndTabs(): void $crawler, ); - $tabs = $crawler->filter('.fr-tabs__list')->eq(0); - $this->assertSame('tablist', $tabs->attr('role')); - $this->assertSame('Temporaires (' . RegulationOrderFixture::NUM_TEMPORARY . ') Permanents (' . RegulationOrderFixture::NUM_PERMANENT . ')', $tabs->text()); + $navLi = $crawler->filter('nav.fr-pagination')->filter('li'); + $this->assertSame('Première page', $navLi->eq(0)->filter('a')->text()); + $this->assertSame('Page précédente', $navLi->eq(1)->filter('a')->text()); + $this->assertSame('1', $navLi->eq(2)->filter('a')->text()); + $this->assertSame('2', $navLi->eq(3)->filter('a')->text()); + $this->assertSame('3', $navLi->eq(4)->filter('a')->text()); + $this->assertSame('...', $navLi->eq(5)->text()); + $this->assertSame('10', $navLi->eq(6)->filter('a')->text()); + $this->assertSame('Page suivante', $navLi->eq(7)->filter('a')->text()); + $this->assertSame('Dernière page', $navLi->eq(8)->filter('a')->text()); $client->clickLink('Ajouter un arrêté'); $this->assertRouteSame('app_regulation_add'); } - public function testTemporaryRegulationRendering(): void + public function testRegulationRendering(): void { $client = $this->login(); // First item - $pageOne = $client->request('GET', '/regulations?pageSize=1&tab=temporary&page=1'); + $pageOne = $client->request('GET', '/regulations?pageSize=1&page=1'); $this->assertResponseStatusCodeSame(200); $this->assertSecurityHeaders(); - $pageOneTemporaryRows = $pageOne->filter('#temporary-panel tbody > tr'); - $this->assertSame(1, $pageOneTemporaryRows->count()); + $pageOneRows = $pageOne->filter('.app-regulation-table tbody > tr'); + $this->assertSame(1, $pageOneRows->count()); - $pageOneTemporaryRow0 = $pageOneTemporaryRows->eq(0)->filter('td'); - $this->assertSame('F2023/no-locations', $pageOneTemporaryRow0->eq(0)->text()); - $this->assertSame('Main Org', $pageOneTemporaryRow0->eq(1)->text()); - $this->assertEmpty($pageOneTemporaryRow0->eq(2)->text()); // No location set - $this->assertSame('du 13/07/2023 au 15/07/2023 passé', $pageOneTemporaryRow0->eq(3)->text()); - $this->assertSame('Brouillon', $pageOneTemporaryRow0->eq(4)->text()); + $pageOneRow0 = $pageOneRows->eq(0)->filter('td'); + $this->assertSame('F2023/no-locations', $pageOneRow0->eq(0)->text()); + $this->assertSame('Main Org', $pageOneRow0->eq(1)->text()); + $this->assertEmpty($pageOneRow0->eq(2)->text()); // No location set + $this->assertSame('du 13/07/2023 au 15/07/2023 passé', $pageOneRow0->eq(3)->text()); + $this->assertSame('Brouillon', $pageOneRow0->eq(4)->text()); - $links = $pageOneTemporaryRow0->eq(5)->filter('a'); + $links = $pageOneRow0->eq(5)->filter('a'); $this->assertSame('Modifier', $links->eq(0)->text()); $this->assertSame('http://localhost/regulations/' . RegulationOrderRecordFixture::UUID_NO_LOCATIONS, $links->eq(0)->link()->getUri()); // Second item - $pageTwo = $client->request('GET', '/regulations?pageSize=1&tab=temporary&page=2'); + $pageTwo = $client->request('GET', '/regulations?pageSize=1&page=2'); $this->assertResponseStatusCodeSame(200); $this->assertSecurityHeaders(); - $pageTwoTemporaryRows = $pageTwo->filter('#temporary-panel tbody > tr'); - $this->assertSame(1, $pageTwoTemporaryRows->count()); // One item per page + $pageTwoRows = $pageTwo->filter('.app-regulation-table tbody > tr'); + $this->assertSame(1, $pageTwoRows->count()); // One item per page - $pageTwoTemporaryRow0 = $pageTwoTemporaryRows->eq(0)->filter('td'); - $this->assertSame('F/CIFS/2023', $pageTwoTemporaryRow0->eq(0)->text()); - $this->assertSame('Main Org', $pageTwoTemporaryRow0->eq(1)->text()); - $this->assertSame('Montauban (82000) Rue de la République + 1 localisation', $pageTwoTemporaryRow0->eq(2)->text()); - $this->assertSame('du 02/06/2023 au 10/06/2023 passé', $pageTwoTemporaryRow0->eq(3)->text()); - $this->assertSame('Publié', $pageTwoTemporaryRow0->eq(4)->text()); + $pageTwoRow0 = $pageTwoRows->eq(0)->filter('td'); + $this->assertSame('F/CIFS/2023', $pageTwoRow0->eq(0)->text()); + $this->assertSame('Main Org', $pageTwoRow0->eq(1)->text()); + $this->assertSame('Montauban (82000) Rue de la République + 1 localisation', $pageTwoRow0->eq(2)->text()); + $this->assertSame('du 02/06/2023 au 10/06/2023 passé', $pageTwoRow0->eq(3)->text()); + $this->assertSame('Publié', $pageTwoRow0->eq(4)->text()); } public function testPublishedRegulationRendering(): void { $client = $this->login(); - $crawler = $client->request('GET', '/regulations?pageSize=1&tab=temporary&page=5'); + $crawler = $client->request('GET', '/regulations?pageSize=1&page=6'); $this->assertResponseStatusCodeSame(200); $this->assertSecurityHeaders(); - $rows = $crawler->filter('#temporary-panel tbody > tr'); + $rows = $crawler->filter('.app-regulation-table tbody > tr'); $this->assertSame(1, $rows->count()); $row0 = $rows->eq(0)->filter('td'); @@ -98,73 +103,6 @@ public function testPublishedRegulationRendering(): void $this->assertSame('http://localhost/regulations/' . RegulationOrderRecordFixture::UUID_PUBLISHED, $links->eq(0)->link()->getUri()); } - public function testPermanentRegulationRendering(): void - { - $client = $this->login(); - $pageOne = $client->request('GET', '/regulations?pageSize=1&tab=permanent&page=1'); - $this->assertResponseStatusCodeSame(200); - $this->assertSecurityHeaders(); - - $pageOnePermanentRows = $pageOne->filter('#permanent-panel tbody > tr'); - $this->assertSame(1, $pageOnePermanentRows->count()); - - $pageOnePermanentRow0 = $pageOnePermanentRows->eq(0)->filter('td'); - $this->assertSame('FO3/2023', $pageOnePermanentRow0->eq(0)->text()); - $this->assertSame('Main Org', $pageOnePermanentRow0->eq(1)->text()); - $this->assertSame('Paris 18e Arrondissement (75018) Rue du Simplon', $pageOnePermanentRow0->eq(2)->text()); - $this->assertSame('à partir du 11/03/2023 en cours', $pageOnePermanentRow0->eq(3)->text()); - $this->assertSame('Brouillon', $pageOnePermanentRow0->eq(4)->text()); - - $links = $pageOnePermanentRow0->eq(5)->filter('a'); - $this->assertSame('Modifier', $links->eq(0)->text()); - $this->assertSame('http://localhost/regulations/' . RegulationOrderRecordFixture::UUID_PERMANENT, $links->eq(0)->link()->getUri()); - } - - public function testPaginationRendering(): void - { - $client = $this->login(); - $pageOne = $client->request('GET', '/regulations?pageSize=1&tab=temporary&page=1'); - $this->assertResponseStatusCodeSame(200); - $this->assertSecurityHeaders(); - - $navLi = $pageOne->filter('nav.fr-pagination')->filter('li'); - $this->assertSame('Première page', $navLi->eq(0)->filter('a')->text()); - $this->assertSame('Page précédente', $navLi->eq(1)->filter('a')->text()); - $this->assertSame('1', $navLi->eq(2)->filter('a')->text()); - $this->assertSame('2', $navLi->eq(3)->filter('a')->text()); - $this->assertSame('3', $navLi->eq(4)->filter('a')->text()); - $this->assertSame('...', $navLi->eq(5)->text()); - $this->assertSame((string) RegulationOrderFixture::NUM_TEMPORARY, $navLi->eq(6)->filter('a')->text()); - $this->assertSame('Page suivante', $navLi->eq(7)->filter('a')->text()); - $this->assertSame('Dernière page', $navLi->eq(8)->filter('a')->text()); - } - - public function testListWithOtherOrganization(): void - { - $client = $this->login(UserFixture::OTHER_ORG_USER_EMAIL); - $pageOne = $client->request('GET', '/regulations'); - $this->assertResponseStatusCodeSame(200); - $this->assertSecurityHeaders(); - - $tabs = $pageOne->filter('.fr-tabs__list')->eq(0); - $this->assertSame('tablist', $tabs->attr('role')); - $this->assertSame('Temporaires (4) Permanents (1)', $tabs->text()); - - $pageOnePermanentRows = $pageOne->filter('#permanent-panel tbody > tr'); - $this->assertSame(1, $pageOnePermanentRows->count()); // One item per page - - $pageOnePermanentRow0 = $pageOnePermanentRows->eq(0)->filter('td'); - $this->assertSame('FO4/2023', $pageOnePermanentRow0->eq(0)->text()); - $this->assertSame('Mairie de Savenay', $pageOnePermanentRow0->eq(1)->text()); - $this->assertEmpty($pageOnePermanentRow0->eq(2)->text()); // No location set - $this->assertEmpty($pageOnePermanentRow0->eq(3)->text()); // No period set - $this->assertSame('Brouillon', $pageOnePermanentRow0->eq(4)->text()); - - $links = $pageOnePermanentRow0->eq(5)->filter('a'); - $this->assertSame('Modifier', $links->eq(0)->text()); - $this->assertSame('http://localhost/regulations/' . RegulationOrderRecordFixture::UUID_OTHER_ORG, $links->eq(0)->link()->getUri()); - } - public function testInvalidPageSize(): void { $client = $this->login(); @@ -198,12 +136,8 @@ public function testWithoutAuthenticatedUser(): void $this->assertResponseStatusCodeSame(200); - $tabs = $pageOne->filter('.fr-tabs__list')->eq(0); - $this->assertSame('tablist', $tabs->attr('role')); - $this->assertSame('Temporaires (4) Permanents (0)', $tabs->text()); - // check that the only link of the first row is to view the regulation - $rows = $pageOne->filter('#temporary-panel tbody > tr'); + $rows = $pageOne->filter('.app-regulation-table tbody > tr'); $row = $rows->eq(0)->filter('td'); $links = $row->filter('a'); $this->assertCount(1, $links); diff --git a/tests/Integration/Infrastructure/Controller/Regulation/RegulationDetailControllerTest.php b/tests/Integration/Infrastructure/Controller/Regulation/RegulationDetailControllerTest.php index 1fa55e9a4..213132025 100644 --- a/tests/Integration/Infrastructure/Controller/Regulation/RegulationDetailControllerTest.php +++ b/tests/Integration/Infrastructure/Controller/Regulation/RegulationDetailControllerTest.php @@ -79,7 +79,7 @@ public function testDraftRegulationDetailAsAdmin(): void // Go back link $goBackLink = $crawler->selectLink('Revenir aux arrêtés'); - $this->assertSame('/regulations?tab=temporary', $goBackLink->extract(['href'])[0]); + $this->assertSame('/regulations', $goBackLink->extract(['href'])[0]); } public function testDraftRegulationDetailAsContributor(): void @@ -101,7 +101,7 @@ public function testPermanentRegulationDetail(): void $this->assertMetaTitle('Arrêté permanent FO3/2023 - DiaLog', $crawler); $goBackLink = $crawler->selectLink('Revenir aux arrêtés'); - $this->assertSame('/regulations?tab=permanent', $goBackLink->extract(['href'])[0]); + $this->assertSame('/regulations', $goBackLink->extract(['href'])[0]); } public function testDraftRegulationDetailWithoutLocations(): void @@ -138,22 +138,6 @@ public function testPublishedRegulationDetail(): void $this->assertSame($formDelete->getMethod(), 'DELETE'); } - public function testSeeAll(): void - { - $client = $this->login(); - $client->request('GET', '/regulations/' . RegulationOrderRecordFixture::UUID_TYPICAL); - - $this->assertSecurityHeaders(); - $this->assertResponseStatusCodeSame(200); - - $crawler = $client->clickLink('Arrêtés de circulation'); - $this->assertRouteSame('app_regulations_list'); - - // Temporary regulation order list is shown. - $temporaryPanel = $crawler->filter('#temporary-panel'); - $this->assertStringContainsString('fr-tabs__panel--selected', $temporaryPanel->attr('class')); - } - public function testCannotAccessBecauseDifferentOrganization(): void { $client = $this->login(UserFixture::OTHER_ORG_USER_EMAIL); diff --git a/tests/Unit/Application/Regulation/Query/GetRegulationsQueryHandlerTest.php b/tests/Unit/Application/Regulation/Query/GetRegulationsQueryHandlerTest.php index 9ff6d82e0..d08538daf 100644 --- a/tests/Unit/Application/Regulation/Query/GetRegulationsQueryHandlerTest.php +++ b/tests/Unit/Application/Regulation/Query/GetRegulationsQueryHandlerTest.php @@ -64,7 +64,7 @@ public function testGetAll(): void $regulationOrderRecordRepository ->expects(self::once()) ->method('findAllRegulations') - ->with(20, 1, true, ['dcab837f-4460-4355-99d5-bf4891c35f8f']) + ->with(20, 1, ['dcab837f-4460-4355-99d5-bf4891c35f8f']) ->willReturn([ 'count' => 3, 'items' => $rows, @@ -74,7 +74,6 @@ public function testGetAll(): void $regulationOrders = $handler(new GetRegulationsQuery( pageSize: 20, page: 1, - isPermanent: true, organizationUuids: ['dcab837f-4460-4355-99d5-bf4891c35f8f'], ));