From f5879cf275fdeda7193e4e74ed7838ab4e3b9a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 15 Jan 2024 20:57:51 +0100 Subject: [PATCH] Apply new CS rules on the news-on-homepage feature --- .../Controller/NewsItemApiController.php | 3 ++- .../Controller/NewsItemHistoryController.php | 3 ++- .../MenuBuilder/AdminNewsMenuBuilder.php | 4 +++- .../Controller/NewsItemApiControllerTest.php | 24 +++++++++++-------- .../Controller/NewsItemControllerTest.php | 7 ++++-- .../NewsItemsHistoryControllerTest.php | 17 +++++++++++-- .../Repository/NewsItemRepositoryTest.php | 5 ++++ 7 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php index c4476a041..786a7e0f1 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemApiController.php @@ -25,7 +25,8 @@ class NewsItemApiController private readonly NewsItemRepository $newsItemRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory - ) {} + ) { + } /** * Get list of news items filtered on start and end date. diff --git a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php index b79812464..cf1f4922b 100644 --- a/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php +++ b/src/Bundle/ChillMainBundle/Controller/NewsItemHistoryController.php @@ -28,7 +28,8 @@ final readonly class NewsItemHistoryController private readonly PaginatorFactory $paginatorFactory, private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory, private readonly Environment $environment, - ) {} + ) { + } /** * @Route("/{_locale}/news-items/history", name="chill_main_news_items_history") diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php index 08e72884f..0ce6a9824 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminNewsMenuBuilder.php @@ -17,7 +17,9 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; class AdminNewsMenuBuilder implements LocalMenuBuilderInterface { - public function __construct(private readonly AuthorizationCheckerInterface $authorizationChecker) {} + public function __construct(private readonly AuthorizationCheckerInterface $authorizationChecker) + { + } public function buildMenu($menuId, MenuItem $menu, array $parameters) { diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemApiControllerTest.php index 5616cf311..1a00e45de 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemApiControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemApiControllerTest.php @@ -1,19 +1,24 @@ assertArrayHasKey('title', $responseContent['data'][0]); } } - } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php index aa6aa821d..c77983454 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemControllerTest.php @@ -17,8 +17,11 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** - * Tests the admin pages for news items + * Tests the admin pages for news items. * + * @internal + * + * @coversNothing */ class NewsItemControllerTest extends WebTestCase { @@ -50,7 +53,7 @@ class NewsItemControllerTest extends WebTestCase public function testList() { $client = $this->getClientAuthenticated(); - $client->request('GET', "/fr/admin/news_item"); + $client->request('GET', '/fr/admin/news_item'); self::assertResponseIsSuccessful('Test that news item admin page shows'); } diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php index 77c471380..329fd7bc0 100644 --- a/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Controller/NewsItemsHistoryControllerTest.php @@ -1,5 +1,14 @@ getClientAuthenticated(); - $client->request('GET', "/fr/news-items/history"); + $client->request('GET', '/fr/news-items/history'); self::assertResponseIsSuccessful('Test that /fr/news-items history shows'); } @@ -54,5 +68,4 @@ class NewsItemsHistoryControllerTest extends WebTestCase $this->assertResponseIsSuccessful('test that single news item page loads successfully'); } - } diff --git a/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php b/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php index 56f4cf499..478ca1bbb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Repository/NewsItemRepositoryTest.php @@ -17,6 +17,11 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Clock\ClockInterface; +/** + * @internal + * + * @coversNothing + */ class NewsItemRepositoryTest extends KernelTestCase { private function getNewsItemsRepository(): NewsItemRepository