Repository: MTES-MCT/dialog
Pull request #1267: Liste des modèles d'arrêté
Author: login: mmarchois
Labels: name: To review
Created: 2025-04-08T12:21:01Z | Merged: 2025-04-09T10:09:10Z

Cette PR permet de rajouter une nouvelle entrée dans l'administration des organisations pour lister les modèles d'arrêtés.


Diff:
diff --git a/src/Application/Regulation/Query/GetRegulationOrderTemplatesQuery.php b/src/Application/Regulation/Query/GetRegulationOrderTemplatesQuery.php
new file mode 100644
index 000000000..e893de8b6
--- /dev/null
+++ b/src/Application/Regulation/Query/GetRegulationOrderTemplatesQuery.php
@@ -0,0 +1,16 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Application\Regulation\Query;
+
+use App\Application\QueryInterface;
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+
+final readonly class GetRegulationOrderTemplatesQuery implements QueryInterface
+{
+    public function __construct(
+        public RegulationOrderTemplateDTO $dto,
+    ) {
+    }
+}
diff --git a/src/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandler.php b/src/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandler.php
new file mode 100644
index 000000000..49c1188c1
--- /dev/null
+++ b/src/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandler.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Application\Regulation\Query;
+
+use App\Domain\Regulation\Repository\RegulationOrderTemplateRepositoryInterface;
+
+final readonly class GetRegulationOrderTemplatesQueryHandler
+{
+    public function __construct(
+        private RegulationOrderTemplateRepositoryInterface $regulationOrderTemplateRepository,
+    ) {
+    }
+
+    public function __invoke(GetRegulationOrderTemplatesQuery $query): array
+    {
+        return $this->regulationOrderTemplateRepository->findByFilters($query->dto);
+    }
+}
diff --git a/src/Application/Regulation/View/RegulationOrderTemplateView.php b/src/Application/Regulation/View/RegulationOrderTemplateView.php
new file mode 100644
index 000000000..2342f69a5
--- /dev/null
+++ b/src/Application/Regulation/View/RegulationOrderTemplateView.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Application\Regulation\View;
+
+final readonly class RegulationOrderTemplateView
+{
+    public function __construct(
+        public string $uuid,
+        public string $name,
+        public ?string $organizationUuid,
+    ) {
+    }
+}
diff --git a/src/Domain/Regulation/DTO/RegulationOrderTemplateDTO.php b/src/Domain/Regulation/DTO/RegulationOrderTemplateDTO.php
new file mode 100644
index 000000000..d436f9a5a
--- /dev/null
+++ b/src/Domain/Regulation/DTO/RegulationOrderTemplateDTO.php
@@ -0,0 +1,10 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Domain\Regulation\DTO;
+
+final class RegulationOrderTemplateDTO
+{
+    public ?string $organizationUuid = null;
+}
diff --git a/src/Domain/Regulation/Repository/RegulationOrderTemplateRepositoryInterface.php b/src/Domain/Regulation/Repository/RegulationOrderTemplateRepositoryInterface.php
new file mode 100644
index 000000000..17bd70d54
--- /dev/null
+++ b/src/Domain/Regulation/Repository/RegulationOrderTemplateRepositoryInterface.php
@@ -0,0 +1,12 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Domain\Regulation\Repository;
+
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+
+interface RegulationOrderTemplateRepositoryInterface
+{
+    public function findByFilters(RegulationOrderTemplateDTO $dto): array;
+}
diff --git a/src/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesController.php b/src/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesController.php
new file mode 100644
index 000000000..f8b5d54aa
--- /dev/null
+++ b/src/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesController.php
@@ -0,0 +1,47 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Infrastructure\Controller\MyArea\Organization\RegulationOrderTemplate;
+
+use App\Application\QueryBusInterface;
+use App\Application\Regulation\Query\GetRegulationOrderTemplatesQuery;
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
+use Symfony\Bundle\SecurityBundle\Security;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Routing\Annotation\Route;
+use Symfony\Component\Routing\Requirement\Requirement;
+
+final class ListRegulationOrderTemplatesController extends AbstractOrganizationController
+{
+    public function __construct(
+        private \Twig\Environment $twig,
+        QueryBusInterface $queryBus,
+        Security $security,
+    ) {
+        parent::__construct($queryBus, $security);
+    }
+
+    #[Route(
+        '/organizations/{uuid}/regulation_order_templates',
+        name: 'app_config_regulation_order_templates_list',
+        requirements: ['uuid' => Requirement::UUID],
+        methods: ['GET'],
+    )]
+    public function __invoke(string $uuid): Response
+    {
+        $organization = $this->getOrganization($uuid);
+        $dto = new RegulationOrderTemplateDTO();
+        $dto->organizationUuid = $organization->getUuid();
+        $regulationOrderTemplates = $this->queryBus->handle(new GetRegulationOrderTemplatesQuery($dto));
+
+        return new Response($this->twig->render(
+            name: 'my_area/organization/regulation_order_template/index.html.twig',
+            context: [
+                'regulationOrderTemplates' => $regulationOrderTemplates,
+                'organization' => $organization,
+            ],
+        ));
+    }
+}
diff --git a/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php
index 0dbad501a..e6336a755 100644
--- a/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php
+++ b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderFixture.php
@@ -17,9 +17,6 @@ final class RegulationOrderFixture extends Fixture
 
     public function load(ObjectManager $manager): void
     {
-        // NOTE : les dates sont à saisir "prêtes à enregistrer en DB", donc faire attention à la timezone
-        $tz = new \DateTimeZone('Etc/GMT-1');
-
         $typicalRegulationOrder = new RegulationOrder(
             uuid: '54eacea0-e1e0-4823-828d-3eae72b76da8',
             identifier: self::TYPICAL_IDENTIFIER,
diff --git a/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderTemplateFixture.php b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderTemplateFixture.php
new file mode 100644
index 000000000..2edcfc923
--- /dev/null
+++ b/src/Infrastructure/Persistence/Doctrine/Fixtures/RegulationOrderTemplateFixture.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Infrastructure\Persistence\Doctrine\Fixtures;
+
+use App\Domain\Regulation\RegulationOrderTemplate;
+use App\Domain\User\Organization;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
+use Doctrine\Persistence\ObjectManager;
+
+final class RegulationOrderTemplateFixture extends Fixture implements DependentFixtureInterface
+{
+    public function load(ObjectManager $manager): void
+    {
+        $globalRegulationOrderTemplate = new RegulationOrderTemplate(
+            uuid: 'ba023736-35f6-49f4-a118-dc94f90ef42e',
+            name: 'Restriction de vitesse sur route nationale',
+            title: 'Arrete permanent n°[numero_arrete]',
+            visaContent: 'VU ...',
+            consideringContent: 'CONSIDERANT ...',
+            articleContent: 'ARTICLES ...',
+            createdAt: new \DateTime('2023-01-01'),
+        );
+
+        $regulationOrderTemplate = new RegulationOrderTemplate(
+            uuid: '54eacea0-e1e0-4823-828d-3eae72b76da8',
+            name: 'Réglementation de vitesse en agglomération',
+            title: 'Arrete temporaire n°[numero_arrete]',
+            visaContent: 'VU ...',
+            consideringContent: 'CONSIDERANT ...',
+            articleContent: 'ARTICLES ...',
+            createdAt: new \DateTime('2025-04-08'),
+            organization: $this->getReference('seineSaintDenisOrg', Organization::class),
+        );
+
+        $manager->persist($globalRegulationOrderTemplate);
+        $manager->persist($regulationOrderTemplate);
+        $manager->flush();
+    }
+
+    public function getDependencies(): array
+    {
+        return [
+            OrganizationFixture::class,
+        ];
+    }
+}
diff --git a/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderTemplateRepository.php b/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderTemplateRepository.php
new file mode 100644
index 000000000..74a15857a
--- /dev/null
+++ b/src/Infrastructure/Persistence/Doctrine/Repository/Regulation/RegulationOrderTemplateRepository.php
@@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Infrastructure\Persistence\Doctrine\Repository\Regulation;
+
+use App\Application\Regulation\View\RegulationOrderTemplateView;
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+use App\Domain\Regulation\RegulationOrderTemplate;
+use App\Domain\Regulation\Repository\RegulationOrderTemplateRepositoryInterface;
+use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
+use Doctrine\Persistence\ManagerRegistry;
+
+final class RegulationOrderTemplateRepository extends ServiceEntityRepository implements RegulationOrderTemplateRepositoryInterface
+{
+    public function __construct(ManagerRegistry $registry)
+    {
+        parent::__construct($registry, RegulationOrderTemplate::class);
+    }
+
+    public function findByFilters(RegulationOrderTemplateDTO $dto): array
+    {
+        $query = $this->createQueryBuilder('rot');
+        $query
+            ->select(
+                \sprintf(
+                    'NEW %s(
+                        rot.uuid,
+                        rot.name,
+                        o.uuid
+                    )',
+                    RegulationOrderTemplateView::class,
+                ),
+            )
+            ->leftJoin('rot.organization', 'o')
+            ->orderBy('rot.createdAt', 'DESC');
+
+        if ($dto->organizationUuid) {
+            $query->where('o.uuid = :organization OR o.uuid is NULL');
+            $query->setParameter('organization', $dto->organizationUuid);
+        }
+
+        return $query
+            ->getQuery()
+            ->getResult()
+        ;
+    }
+}
diff --git a/templates/my_area/organization/_menu.html.twig b/templates/my_area/organization/_menu.html.twig
index 6dba7d6ef..42676b097 100644
--- a/templates/my_area/organization/_menu.html.twig
+++ b/templates/my_area/organization/_menu.html.twig
@@ -16,6 +16,11 @@
                         {{ 'config.menu.users'|trans }}
                     </a>
                 </li>
+                <li class="fr-sidemenu__item {% if 'app_config_regulation_order_templates' in routeName %}fr-sidemenu__item--active{% endif %}">
+                    <a class="fr-sidemenu__link" href="{{ path('app_config_regulation_order_templates_list', { uuid: organization.uuid }) }}" {% if 'app_config_regulation_order_templates' in routeName %}aria-current="page"{% endif%}>
+                        {{ 'config.menu.regulation_order_templates'|trans }}
+                    </a>
+                </li>
                 <li class="fr-sidemenu__item">
                     <button class="fr-sidemenu__btn" aria-expanded="{{ 'app_config_visa' in routeName or 'app_config_organization_edit_logo' in routeName or 'app_config_signing_authority' in routeName ? 'true' : 'false' }}" aria-controls="sidemenu-config">{{ 'config.menu.regulations'|trans }}</button>
                     <div class="fr-collapse" id="sidemenu-config">
diff --git a/templates/my_area/organization/regulation_order_template/index.html.twig b/templates/my_area/organization/regulation_order_template/index.html.twig
new file mode 100644
index 000000000..ec6535570
--- /dev/null
+++ b/templates/my_area/organization/regulation_order_template/index.html.twig
@@ -0,0 +1,49 @@
+{% extends 'layouts/layout.html.twig' %}
+
+{% block title %}
+    {{'regulation_order_template.list.title'|trans }} - {{ parent() }}
+{% endblock %}
+
+{% block body %}
+    <section class="fr-container fr-py-5w" aria-labelledby="visa-list">
+        <div class="fr-grid-row fr-grid-row--gutters">
+            <div class="fr-col-12 fr-col-md-4">
+                {% include 'my_area/organization/_menu.html.twig' with { organization } only %}
+            </div>
+            <div class="fr-col-12 fr-col-md-8">
+                {% include "common/breadcrumb.html.twig" with { items: [
+                    { title: 'user.myarea'|trans, path: 'app_my_area'},
+                    { title: organization.name, url: path('app_config_organization_detail', {uuid: organization.uuid}), generatedPath: true },
+                    { title: 'regulation_order_template.list.title'|trans },
+                ]} %}
+                <div class="fr-grid-row">
+                    <h2 id="regulation-order-template-list" class="fr-col fr-mb-0">{{ 'regulation_order_template.list.title'|trans }}</h2>
+                </div>
+                <p class="fr-text--sm fr-my-2w">{{ 'regulation_order_template.list.help'|trans }}</p>
+                <div class="fr-table fr-table--layout-fixed fr-table--no-caption">
+                    <table>
+                        <thead>
+                            <tr>
+                                <th scope="col">{{ 'regulation_order_template.name'|trans }}</th>
+                                <th scope="col" class="app-table__actions">{{ 'common.actions'|trans }}</th>
+                            </tr>
+                        </thead>
+                        <tbody data-testid="regulation-order-template-list">
+                            {% for regulationOrderTemplate in regulationOrderTemplates %}
+                                <tr>
+                                    <td>
+                                        {{ regulationOrderTemplate.name }}
+                                        {% if not regulationOrderTemplate.organizationUuid %}<span class="fr-tag fr-tag--sm">DiaLog</span>{% endif %}
+                                    </td>
+                                    <td>
+                                    </td>
+                                </tr>
+                            {% endfor %}
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+    </section>
+{% endblock %}
+
diff --git a/tests/Integration/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesControllerTest.php b/tests/Integration/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesControllerTest.php
new file mode 100644
index 000000000..db60e8347
--- /dev/null
+++ b/tests/Integration/Infrastructure/Controller/MyArea/Organization/RegulationOrderTemplate/ListRegulationOrderTemplatesControllerTest.php
@@ -0,0 +1,52 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Tests\Integration\Infrastructure\Controller\MyArea\Organization\RegulationOrderTemplate;
+
+use App\Infrastructure\Persistence\Doctrine\Fixtures\OrganizationFixture;
+use App\Infrastructure\Persistence\Doctrine\Fixtures\UserFixture;
+use App\Tests\Integration\Infrastructure\Controller\AbstractWebTestCase;
+
+final class ListRegulationOrderTemplatesControllerTest extends AbstractWebTestCase
+{
+    public function testIndex(): void
+    {
+        $client = $this->login(UserFixture::DEPARTMENT_93_ADMIN_EMAIL);
+        $crawler = $client->request('GET', '/mon-espace/organizations/' . OrganizationFixture::SEINE_SAINT_DENIS_ID . '/regulation_order_templates');
+
+        $this->assertResponseStatusCodeSame(200);
+        $this->assertSecurityHeaders();
+        $this->assertSame('Modèles d\'arrêtés', $crawler->filter('h2')->text());
+        $this->assertMetaTitle('Modèles d\'arrêtés - DiaLog', $crawler);
+
+        $rows = $crawler->filter('[data-testid="regulation-order-template-list"]');
+        $tr0 = $rows->filter('tr')->eq(0)->filter('td');
+        $tr1 = $rows->filter('tr')->eq(1)->filter('td');
+        $this->assertCount(2, $rows->filter('tr'));
+
+        $this->assertSame('Réglementation de vitesse en agglomération', $tr0->eq(0)->text());
+        $this->assertSame('Restriction de vitesse sur route nationale DiaLog', $tr1->eq(0)->text());
+    }
+
+    public function testOrganizationNotOwned(): void
+    {
+        $client = $this->login();
+        $client->request('GET', '/mon-espace/organizations/' . OrganizationFixture::REGION_IDF_ID . '/regulation_order_templates');
+        $this->assertResponseStatusCodeSame(403);
+    }
+
+    public function testOrganizationNotFound(): void
+    {
+        $client = $this->login();
+        $client->request('GET', '/mon-espace/organizations/f5c1cea8-a61d-43a7-9b5d-4b8c9557c673/regulation_order_templates');
+        $this->assertResponseStatusCodeSame(404);
+    }
+
+    public function testWithoutAuthenticatedUser(): void
+    {
+        $client = static::createClient();
+        $client->request('GET', '/mon-espace/organizations/' . OrganizationFixture::SEINE_SAINT_DENIS_ID . '/regulation_order_templates');
+        $this->assertResponseRedirects('http://localhost/login', 302);
+    }
+}
diff --git a/tests/Unit/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandlerTest.php b/tests/Unit/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandlerTest.php
new file mode 100644
index 000000000..f5804bf4b
--- /dev/null
+++ b/tests/Unit/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandlerTest.php
@@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Tests\Unit\Application\Regulation\Query;
+
+use App\Application\Regulation\Query\GetRegulationOrderTemplatesQuery;
+use App\Application\Regulation\Query\GetRegulationOrderTemplatesQueryHandler;
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+use App\Domain\Regulation\Repository\RegulationOrderTemplateRepositoryInterface;
+use PHPUnit\Framework\TestCase;
+
+final class GetRegulationOrderTemplatesQueryHandlerTest extends TestCase
+{
+    public function testGetByOrganization(): void
+    {
+        $rows = [
+            [
+                'uuid' => '247edaa2-58d1-43de-9d33-9753bf6f4d30',
+                'name' => 'Restriction de vitesse sur route départementale',
+            ],
+            [
+                'uuid' => '3d1c6ec7-28f5-4b6b-be71-b0920e85b4bf',
+                'name' => 'Restriction de vitesse sur route nationale',
+            ],
+            [
+                'uuid' => 'ef5b3632-8525-41b5-9e84-3116d9089610',
+                'name' => 'Restriction de circulation',
+            ],
+        ];
+
+        $dto = new RegulationOrderTemplateDTO();
+        $dto->organizationUuid = 'dcab837f-4460-4355-99d5-bf4891c35f8f';
+
+        $regulationOrderTemplateRepository = $this->createMock(RegulationOrderTemplateRepositoryInterface::class);
+
+        $regulationOrderTemplateRepository
+            ->expects(self::once())
+            ->method('findByFilters')
+            ->with($dto)
+            ->willReturn($rows);
+
+        $handler = new GetRegulationOrderTemplatesQueryHandler($regulationOrderTemplateRepository);
+        $regulationOrderTemaplates = $handler(new GetRegulationOrderTemplatesQuery($dto));
+
+        $this->assertEquals($rows, $regulationOrderTemaplates);
+    }
+}
diff --git a/translations/messages.fr.xlf b/translations/messages.fr.xlf
index 71a40b1da..92e4dc336 100644
--- a/translations/messages.fr.xlf
+++ b/translations/messages.fr.xlf
@@ -2389,6 +2389,10 @@
                 <source>config.menu.organization</source>
                 <target>Mon organisation</target>
             </trans-unit>
+            <trans-unit id="config.menu.regulation_order_templates">
+                <source>config.menu.regulation_order_templates</source>
+                <target>Modèles d'arrêtés</target>
+            </trans-unit>
             <trans-unit id="config.menu.organization.edit">
                 <source>config.menu.organization.edit</source>
                 <target>Modifier mon organisation</target>
@@ -2605,6 +2609,18 @@
                 <source>invitation.list.delete</source>
                 <target>Supprimer cette invitation</target>
             </trans-unit>
+            <trans-unit id="regulation_order_template.list.title">
+                <source>regulation_order_template.list.title</source>
+                <target>Modèles d'arrêtés</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.list.help">
+                <source>regulation_order_template.list.help</source>
+                <target>Créer des modèles d'arrêtés à utiliser par les agents dans les arrêtés de circulation créés dans DiaLog.</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.name">
+                <source>regulation_order_template.name</source>
+                <target>Nom du modèle</target>
+            </trans-unit>
         </body>
     </file>
 </xliff>


Reviews:
user: login: Lealefoulon
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:47:39Z
user: login: Lealefoulon
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:48:34Z
user: login: Lealefoulon
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:59:20Z
user: login: Lealefoulon
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T10:09:09Z

Review comments:
diff_hunk: @@ -2605,6 +2609,18 @@
                 <source>invitation.list.delete</source>
                 <target>Supprimer cette invitation</target>
             </trans-unit>
+            <trans-unit id="regulation_order_template.list.title">
+                <source>regulation_order_template.list.title</source>
+                <target>Modèles d'arrêtés</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.list.help">
+                <source>regulation_order_template.list.help</source>
+                <target>Créer des modèles d'arrêtés à utiliser par les agents dans les arrêtés de circulation créés dans DiaLog.</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.name">
+                <source>regulation_order_template.name</source>
+                <target>Nom du modèle</target>
path: translations/messages.fr.xlf
user: login: Lealefoulon
body: ```suggestion
                <target>Nom</target>
```
created_at: 2025-04-09T09:47:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -2605,6 +2609,18 @@
                 <source>invitation.list.delete</source>
                 <target>Supprimer cette invitation</target>
             </trans-unit>
+            <trans-unit id="regulation_order_template.list.title">
+                <source>regulation_order_template.list.title</source>
+                <target>Modèles d'arrêtés</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.list.help">
+                <source>regulation_order_template.list.help</source>
+                <target>Créer des modèles d'arrêtés à utiliser par les agents dans les arrêtés de circulation créés dans DiaLog.</target>
+            </trans-unit>
+            <trans-unit id="regulation_order_template.name">
+                <source>regulation_order_template.name</source>
+                <target>Nom du modèle</target>
path: translations/messages.fr.xlf
user: login: Lealefoulon
body: Je ne sais pas si c'est vraiment important. Sur la maquette c'est noté "Nom" c'est peut être moins clair que Nom du modèle remarque. As you want ;)
created_at: 2025-04-09T09:48:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Tests\Unit\Application\Regulation\Query;
+
+use App\Application\Regulation\Query\GetRegulationOrderTemplatesQuery;
+use App\Application\Regulation\Query\GetRegulationOrderTemplatesQueryHandler;
+use App\Domain\Regulation\DTO\RegulationOrderTemplateDTO;
+use App\Domain\Regulation\Repository\RegulationOrderTemplateRepositoryInterface;
+use PHPUnit\Framework\TestCase;
+
+final class GetRegulationOrderTemplatesQueryHandlerTest extends TestCase
+{
+    public function testGetByOrganization(): void
+    {
+        $rows = [
+            [
+                'uuid' => '247edaa2-58d1-43de-9d33-9753bf6f4d30',
+                'name' => 'Restriction de vitesse sur route départementale',
+            ],
+            [
+                'uuid' => '3d1c6ec7-28f5-4b6b-be71-b0920e85b4bf',
+                'name' => 'Restriction de vitesse sur route nationale',
+            ],
+            [
+                'uuid' => 'ef5b3632-8525-41b5-9e84-3116d9089610',
+                'name' => 'Restriction de circulation',
+            ],
+        ];
+
+        $dto = new RegulationOrderTemplateDTO();
+        $dto->organizationUuid = 'dcab837f-4460-4355-99d5-bf4891c35f8f';
+
+        $regulationOrderTemplateRepository = $this->createMock(RegulationOrderTemplateRepositoryInterface::class);
+
+        $regulationOrderTemplateRepository
+            ->expects(self::once())
+            ->method('findByFilters')
+            ->with($dto)
+            ->willReturn($rows);
+
+        $handler = new GetRegulationOrderTemplatesQueryHandler($regulationOrderTemplateRepository);
+        $regulationOrderTemaplates = $handler(new GetRegulationOrderTemplatesQuery($dto));
path: tests/Unit/Application/Regulation/Query/GetRegulationOrderTemplatesQueryHandlerTest.php
user: login: Lealefoulon
body: ```suggestion
        $regulationOrderTemplates = $handler(new GetRegulationOrderTemplatesQuery($dto));
```
created_at: 2025-04-09T09:59:19Z
author_association: CONTRIBUTOR

PR comments:
user: login: codecov-commenter
created_at: 2025-04-08T12:27:39Z
body: ## [Codecov](https://app.codecov.io/gh/MTES-MCT/dialog/pull/1267?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MTES-MCT) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 97.65%. Comparing base [(`f7fec6c`)](https://app.codecov.io/gh/MTES-MCT/dialog/commit/f7fec6cb34d75528c2ec3417432aaf7d8e29943f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MTES-MCT) to head [(`91cef82`)](https://app.codecov.io/gh/MTES-MCT/dialog/commit/91cef822654b37578df41e2e79b12432fbcd56dd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MTES-MCT).

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff              @@
##               main    #1267      +/-   ##
============================================
+ Coverage     97.64%   97.65%   +0.01%     
- Complexity     2169     2178       +9     
============================================
  Files           441      446       +5     
  Lines          9327     9370      +43     
============================================
+ Hits           9107     9150      +43     
  Misses          220      220              
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/MTES-MCT/dialog/pull/1267?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MTES-MCT).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MTES-MCT).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
author_association: NONE
user: login: mmarchois
created_at: 2025-04-08T13:11:38Z
body: @Lealefoulon la PR est prête à la review
author_association: COLLABORATOR
user: login: Lealefoulon
created_at: 2025-04-09T10:08:23Z
body: :clap: j'approuve d'avance malgré petite typo
author_association: CONTRIBUTOR
user: login: mmarchois
created_at: 2025-04-10T07:53:14Z
body: Mince la PR était en auto-merge et s'est merge toute seule avec ton approuval. Je vais traiter tes commentaires dans une autre PR. Merci pour la review Léa :)
author_association: COLLABORATOR