From 80d8f967fa7bc4161ed6dd3752422b3712747231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Apr 2025 13:20:48 +0200 Subject: [PATCH] Moved export listing functionality from ExportController to a new ExportIndexController for improved separation of concerns. Updated tests accordingly to reflect the new controller structure. --- .../Controller/ExportController.php | 15 -------- .../Controller/ExportIndexController.php | 37 +++++++++++++++++++ ...Test.php => ExportIndexControllerTest.php} | 4 +- 3 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Controller/ExportIndexController.php rename src/Bundle/ChillMainBundle/Tests/Controller/{ExportControllerTest.php => ExportIndexControllerTest.php} (84%) diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 3587a3f52..bd4a946d7 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -178,21 +178,6 @@ class ExportController extends AbstractController return new Response('Ok: '.$exportGeneration->getId()->toString()); } - /** - * Render the list of available exports. - */ - #[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')] - public function indexAction(): Response - { - $exportManager = $this->exportManager; - - $exports = $exportManager->getExportsGrouped(true); - - return $this->render('@ChillMain/Export/layout.html.twig', [ - 'grouped_exports' => $exports, - ]); - } - /** * handle the step to build a query for an export. * diff --git a/src/Bundle/ChillMainBundle/Controller/ExportIndexController.php b/src/Bundle/ChillMainBundle/Controller/ExportIndexController.php new file mode 100644 index 000000000..51cd04833 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/ExportIndexController.php @@ -0,0 +1,37 @@ +exportManager->getExportsGrouped(true); + + return new Response( + $this->twig->render('@ChillMain/Export/layout.html.twig', [ + 'grouped_exports' => $exports, + ]), + ); + } +} diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/ExportIndexControllerTest.php similarity index 84% rename from src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php rename to src/Bundle/ChillMainBundle/Tests/Controller/ExportIndexControllerTest.php index 6c7ade9bb..beaff9b5c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/ExportIndexControllerTest.php @@ -21,13 +21,13 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; * * @coversNothing */ -final class ExportControllerTest extends WebTestCase +final class ExportIndexControllerTest extends WebTestCase { use PrepareClientTrait; public function testIndex() { - $client = $this->getClientAuthenticatedAsAdmin(); + $client = $this->getClientAuthenticated(); $client->request('GET', '/fr/exports/');