mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-05 07:19:49 +00:00
Apply new CS rules on the news-on-homepage feature
This commit is contained in:
parent
8cc5859a3b
commit
f5879cf275
@ -25,7 +25,8 @@ class NewsItemApiController
|
|||||||
private readonly NewsItemRepository $newsItemRepository,
|
private readonly NewsItemRepository $newsItemRepository,
|
||||||
private readonly SerializerInterface $serializer,
|
private readonly SerializerInterface $serializer,
|
||||||
private readonly PaginatorFactory $paginatorFactory
|
private readonly PaginatorFactory $paginatorFactory
|
||||||
) {}
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of news items filtered on start and end date.
|
* Get list of news items filtered on start and end date.
|
||||||
|
@ -28,7 +28,8 @@ final readonly class NewsItemHistoryController
|
|||||||
private readonly PaginatorFactory $paginatorFactory,
|
private readonly PaginatorFactory $paginatorFactory,
|
||||||
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
|
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
|
||||||
private readonly Environment $environment,
|
private readonly Environment $environment,
|
||||||
) {}
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/news-items/history", name="chill_main_news_items_history")
|
* @Route("/{_locale}/news-items/history", name="chill_main_news_items_history")
|
||||||
|
@ -17,7 +17,9 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
|||||||
|
|
||||||
class AdminNewsMenuBuilder implements LocalMenuBuilderInterface
|
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)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
{
|
{
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Controller;
|
namespace Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Controller\NewsItemApiController;
|
|
||||||
use Chill\MainBundle\Entity\NewsItem;
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
|
||||||
use Chill\MainBundle\Repository\NewsItemRepository;
|
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
class NewsItemApiControllerTest extends WebTestCase
|
class NewsItemApiControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
use PrepareClientTrait;
|
use PrepareClientTrait;
|
||||||
@ -31,5 +36,4 @@ class NewsItemApiControllerTest extends WebTestCase
|
|||||||
$this->assertArrayHasKey('title', $responseContent['data'][0]);
|
$this->assertArrayHasKey('title', $responseContent['data'][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
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
|
class NewsItemControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
@ -50,7 +53,7 @@ class NewsItemControllerTest extends WebTestCase
|
|||||||
public function testList()
|
public function testList()
|
||||||
{
|
{
|
||||||
$client = $this->getClientAuthenticated();
|
$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');
|
self::assertResponseIsSuccessful('Test that news item admin page shows');
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Controller;
|
namespace Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\NewsItem;
|
use Chill\MainBundle\Entity\NewsItem;
|
||||||
@ -7,6 +16,11 @@ use Chill\MainBundle\Test\PrepareClientTrait;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
class NewsItemsHistoryControllerTest extends WebTestCase
|
class NewsItemsHistoryControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
use PrepareClientTrait;
|
use PrepareClientTrait;
|
||||||
@ -38,7 +52,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
$client = $this->getClientAuthenticated();
|
$client = $this->getClientAuthenticated();
|
||||||
|
|
||||||
$client->request('GET', "/fr/news-items/history");
|
$client->request('GET', '/fr/news-items/history');
|
||||||
|
|
||||||
self::assertResponseIsSuccessful('Test that /fr/news-items history shows');
|
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');
|
$this->assertResponseIsSuccessful('test that single news item page loads successfully');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\Clock\ClockInterface;
|
use Symfony\Component\Clock\ClockInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
class NewsItemRepositoryTest extends KernelTestCase
|
class NewsItemRepositoryTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private function getNewsItemsRepository(): NewsItemRepository
|
private function getNewsItemsRepository(): NewsItemRepository
|
||||||
|
Loading…
x
Reference in New Issue
Block a user