mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 17:44:58 +00:00
Rector changes and immplementations of required methods
This commit is contained in:
@@ -49,7 +49,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function createAction($person_id, $cf_group_id, Request $request)
|
||||
public function createAction($person_id, $cf_group_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -111,7 +111,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function editAction(int|string $person_id, int|string $report_id)
|
||||
public function editAction(int|string $person_id, int|string $report_id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -179,7 +179,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function listAction($person_id, Request $request)
|
||||
public function listAction($person_id, Request $request): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -236,7 +236,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function newAction($person_id, $cf_group_id, Request $request)
|
||||
public function newAction($person_id, $cf_group_id, Request $request): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -284,7 +284,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function selectReportTypeAction($person_id, Request $request)
|
||||
public function selectReportTypeAction($person_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -348,7 +348,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function selectReportTypeForExportAction(Request $request)
|
||||
public function selectReportTypeForExportAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$cFGroupId = $request->query->get('cFGroup');
|
||||
|
||||
@@ -395,7 +395,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function updateAction($person_id, $report_id, Request $request)
|
||||
public function updateAction($person_id, $report_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -455,7 +455,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return Response the web page
|
||||
*/
|
||||
public function viewAction($report_id, $person_id)
|
||||
public function viewAction($report_id, $person_id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -489,7 +489,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createCreateForm(Report $entity, Person $person, mixed $cFGroup)
|
||||
private function createCreateForm(Report $entity, Person $person, mixed $cFGroup): \Symfony\Component\Form\FormInterface
|
||||
{
|
||||
return $this->createForm(ReportType::class, $entity, [
|
||||
'action' => $this->generateUrl(
|
||||
@@ -511,7 +511,7 @@ class ReportController extends AbstractController
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createEditForm(Report $entity)
|
||||
private function createEditForm(Report $entity): \Symfony\Component\Form\FormInterface
|
||||
{
|
||||
return $this->createForm(ReportType::class, $entity, [
|
||||
'action' => $this->generateUrl(
|
||||
|
@@ -85,7 +85,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
private function createExpectedFields(ObjectManager $manager)
|
||||
private function createExpectedFields(ObjectManager $manager): void
|
||||
{
|
||||
// report logement
|
||||
$reportLogement = $this->getReference('cf_group_report_logement', CustomFieldsGroup::class);
|
||||
|
@@ -54,7 +54,7 @@ final class LoadReports extends AbstractFixture implements OrderedFixtureInterfa
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
private function createExpected(ObjectManager $manager)
|
||||
private function createExpected(ObjectManager $manager): void
|
||||
{
|
||||
$charline = $this->entityManager
|
||||
->getRepository(Person::class)
|
||||
@@ -74,7 +74,7 @@ final class LoadReports extends AbstractFixture implements OrderedFixtureInterfa
|
||||
}
|
||||
}
|
||||
|
||||
private function createRandom(ObjectManager $manager, $percentage)
|
||||
private function createRandom(ObjectManager $manager, $percentage): void
|
||||
{
|
||||
$people = $this->getPeopleRandom($percentage);
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
|
||||
/**
|
||||
* Declare the entity Report, as a customizable entity (can add custom fields).
|
||||
*/
|
||||
public function declareReportAsCustomizable(ContainerBuilder $container)
|
||||
public function declareReportAsCustomizable(ContainerBuilder $container): void
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
|
||||
@@ -57,7 +57,7 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
|
||||
);
|
||||
}
|
||||
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
@@ -69,7 +69,7 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
|
||||
$loader->load('services/controller.yaml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
public function prepend(ContainerBuilder $container): void
|
||||
{
|
||||
$this->declareReportAsCustomizable($container);
|
||||
$this->declareRouting($container);
|
||||
@@ -89,7 +89,7 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
|
||||
/**
|
||||
* declare routes from report bundle.
|
||||
*/
|
||||
private function declareRouting(ContainerBuilder $container)
|
||||
private function declareRouting(ContainerBuilder $container): void
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'routing' => [
|
||||
|
@@ -64,7 +64,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCFData()
|
||||
public function getCFData(): ?array
|
||||
{
|
||||
return $this->cFData;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return CustomFieldsGroup
|
||||
*/
|
||||
public function getCFGroup()
|
||||
public function getCFGroup(): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
|
||||
{
|
||||
return $this->cFGroup;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson()
|
||||
public function getPerson(): ?\Chill\PersonBundle\Entity\Person
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return Scope
|
||||
*/
|
||||
public function getScope()
|
||||
public function getScope(): ?\Chill\MainBundle\Entity\Scope
|
||||
{
|
||||
return $this->scope;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class Report implements HasCenterInterface, HasScopeInterface
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUser()
|
||||
public function getUser(): ?\Chill\MainBundle\Entity\User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
|
||||
public function __construct(protected CustomFieldsGroup $customfieldsGroup, protected TranslatableStringHelper $translatableStringHelper, protected TranslatorInterface $translator, protected CustomFieldProvider $customFieldProvider, protected EntityManagerInterface $em) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
$choices = array_combine($this->fields, $this->fields);
|
||||
|
||||
@@ -107,7 +107,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
return [FormatterInterface::TYPE_LIST];
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->translator->trans(
|
||||
"Generate list of report '%type%'",
|
||||
@@ -272,7 +272,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->translator->trans(
|
||||
"List for report '%type%'",
|
||||
@@ -413,7 +413,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
return [Declarations::PERSON_TYPE, 'report'];
|
||||
}
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
public function validateForm($data, ExecutionContextInterface $context): void
|
||||
{
|
||||
// get the field starting with address_
|
||||
$addressFields = array_filter(
|
||||
@@ -448,7 +448,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
||||
*
|
||||
* @return CustomField[]
|
||||
*/
|
||||
private function getCustomFields()
|
||||
private function getCustomFields(): array
|
||||
{
|
||||
return array_filter($this->customfieldsGroup
|
||||
->getCustomFields()->toArray(), static fn (CustomField $cf) => 'title' !== $cf->getType());
|
||||
|
@@ -26,7 +26,7 @@ class ReportDateFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
|
||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data): void
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->between(
|
||||
@@ -57,7 +57,7 @@ class ReportDateFilter implements FilterInterface
|
||||
return 'report';
|
||||
}
|
||||
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder): void
|
||||
{
|
||||
$builder->add('date_from', PickRollingDateType::class, [
|
||||
'label' => 'Report is after this date',
|
||||
|
@@ -34,7 +34,7 @@ final class ReportType extends AbstractType
|
||||
private readonly ObjectManager $om,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('user')
|
||||
@@ -67,7 +67,7 @@ final class ReportType extends AbstractType
|
||||
);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => \Chill\ReportBundle\Entity\Report::class,
|
||||
@@ -85,7 +85,7 @@ final class ReportType extends AbstractType
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'chill_reportbundle_report';
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
|
||||
return [self::LISTS];
|
||||
}
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
protected function supports($attribute, $subject): bool
|
||||
{
|
||||
if ($subject instanceof Report) {
|
||||
return \in_array($attribute, [
|
||||
@@ -67,7 +67,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
|
||||
}
|
||||
}
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
||||
{
|
||||
if (!$token->getUser() instanceof User) {
|
||||
return false;
|
||||
|
@@ -68,7 +68,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
$this->group = $filteredCustomFieldsGroupHouse[0];
|
||||
}
|
||||
|
||||
public function testUngrantedUserIsDeniedAccessOnListReports()
|
||||
public function testUngrantedUserIsDeniedAccessOnListReports(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient('center b_social');
|
||||
$client->request('GET', sprintf(
|
||||
@@ -84,7 +84,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testUngrantedUserIsDeniedAccessOnReport()
|
||||
public function testUngrantedUserIsDeniedAccessOnReport(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient('center b_social');
|
||||
$reports = self::$kernel->getContainer()->get('doctrine.orm.entity_manager')
|
||||
@@ -106,7 +106,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testUngrantedUserIsDeniedReportCreate()
|
||||
public function testUngrantedUserIsDeniedReportCreate(): void
|
||||
{
|
||||
$clientCenterA = $this->getAuthenticatedClient('center a_social');
|
||||
|
||||
@@ -123,7 +123,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testUngrantedUserIsDeniedReportNew()
|
||||
public function testUngrantedUserIsDeniedReportNew(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient('center b_social');
|
||||
|
||||
@@ -141,7 +141,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testValidCreate()
|
||||
public function testValidCreate(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$form = $this->getReportForm($this->person, $this->group, $client);
|
||||
@@ -158,7 +158,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
protected function getAuthenticatedClient($username = 'center a_social')
|
||||
protected function getAuthenticatedClient($username = 'center a_social'): \Symfony\Bundle\FrameworkBundle\KernelBrowser
|
||||
{
|
||||
return self::createClient([], [
|
||||
'PHP_AUTH_USER' => $username,
|
||||
@@ -169,7 +169,7 @@ final class ReportControllerNextTest extends WebTestCase
|
||||
/**
|
||||
* @return \Symfony\Component\DomCrawler\Form
|
||||
*/
|
||||
protected function getReportForm(Person $person, CustomFieldsGroup $group, \Symfony\Component\BrowserKit\AbstractBrowser $client)
|
||||
protected function getReportForm(Person $person, CustomFieldsGroup $group, \Symfony\Component\BrowserKit\AbstractBrowser $client): \Symfony\Component\DomCrawler\Form
|
||||
{
|
||||
$url = sprintf(
|
||||
'fr/person/%d/report/cfgroup/%d/new',
|
||||
|
@@ -101,7 +101,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
public function getAuthenticatedClient($username = 'center a_social')
|
||||
public function getAuthenticatedClient($username = 'center a_social'): \Symfony\Bundle\FrameworkBundle\KernelBrowser
|
||||
{
|
||||
return self::createClient([], [
|
||||
'PHP_AUTH_USER' => $username,
|
||||
@@ -114,7 +114,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @depends testMenu
|
||||
*/
|
||||
public function testChooseReportModelPage(Link $link)
|
||||
public function testChooseReportModelPage(Link $link): \Symfony\Component\DomCrawler\Crawler
|
||||
{
|
||||
// When I click on "add a report" link in menu
|
||||
$client = $this->getAuthenticatedClient();
|
||||
@@ -172,7 +172,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @depends testNewReportPage
|
||||
*/
|
||||
public function testInvalidUser(Form $form)
|
||||
public function testInvalidUser(Form $form): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$filledForm = $this->fillCorrectForm($form);
|
||||
@@ -191,7 +191,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @param int $reportId
|
||||
*/
|
||||
public function testList($reportId)
|
||||
public function testList($reportId): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$crawler = $client->request('GET', sprintf(
|
||||
@@ -283,7 +283,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
/**
|
||||
* Test that setting a Null date redirect to an error page.
|
||||
*/
|
||||
public function testNullDate()
|
||||
public function testNullDate(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$form = $this->getReportForm(
|
||||
@@ -308,7 +308,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @param int $reportId
|
||||
*/
|
||||
public function testUpdate($reportId)
|
||||
public function testUpdate($reportId): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$crawler = $client->request(
|
||||
@@ -387,7 +387,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @param int $reportId
|
||||
*/
|
||||
public function testView($reportId)
|
||||
public function testView($reportId): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
$client->request(
|
||||
@@ -412,7 +412,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
Person $person,
|
||||
CustomFieldsGroup $group,
|
||||
\Symfony\Component\BrowserKit\AbstractBrowser $client,
|
||||
) {
|
||||
): \Symfony\Component\DomCrawler\Form {
|
||||
$url = sprintf(
|
||||
'fr/person/%d/report/cfgroup/%d/new',
|
||||
$person->getId(),
|
||||
@@ -441,7 +441,7 @@ final class ReportControllerTest extends WebTestCase
|
||||
*
|
||||
* @param bool $isDefault if the form should be at default values
|
||||
*/
|
||||
private function isFormAsExpected(Form $form, $isDefault = true)
|
||||
private function isFormAsExpected(Form $form, $isDefault = true): void
|
||||
{
|
||||
$this->assertTrue(
|
||||
$form->has('chill_reportbundle_report[date]'),
|
||||
|
@@ -26,7 +26,7 @@ final class ChillReportExtensionTest extends KernelTestCase
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testDeclareReportAsCustomizable()
|
||||
public function testDeclareReportAsCustomizable(): void
|
||||
{
|
||||
self::bootKernel(['environment' => 'test']);
|
||||
$customizablesEntities = self::$kernel->getContainer()
|
||||
|
@@ -33,7 +33,7 @@ final class ReportDateFilterTest extends AbstractFilterTest
|
||||
$this->filter = self::getContainer()->get(ReportDateFilter::class);
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
public function getFilter(): \Chill\ReportBundle\Export\Filter\ReportDateFilter
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
*/
|
||||
final class ReportSearchTest extends WebTestCase
|
||||
{
|
||||
public function testNamedSearch()
|
||||
public function testNamedSearch(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
|
||||
@@ -34,7 +34,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
}
|
||||
|
||||
public function testSearchByDate()
|
||||
public function testSearchByDate(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
|
||||
@@ -46,7 +46,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
$this->assertMatchesRegularExpression('/Situation de logement/i', $crawler->text());
|
||||
}
|
||||
|
||||
public function testSearchDoubleDate()
|
||||
public function testSearchDoubleDate(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
|
||||
@@ -57,7 +57,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count());
|
||||
}
|
||||
|
||||
public function testSearchEmtpy()
|
||||
public function testSearchEmtpy(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
|
||||
@@ -68,7 +68,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count());
|
||||
}
|
||||
|
||||
public function testSearchExpectedDefault()
|
||||
public function testSearchExpectedDefault(): void
|
||||
{
|
||||
$client = $this->getAuthenticatedClient();
|
||||
|
||||
@@ -86,7 +86,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
* We test for that that :
|
||||
* - we do not see any unauthorized scope mention
|
||||
*/
|
||||
public function testUsersDoNotSeeUnauthorizedResults()
|
||||
public function testUsersDoNotSeeUnauthorizedResults(): void
|
||||
{
|
||||
$clientSocial = $this->getAuthenticatedClient();
|
||||
$clientAdministrative = $this->getAuthenticatedClient('center a_administrative');
|
||||
@@ -105,7 +105,7 @@ final class ReportSearchTest extends WebTestCase
|
||||
/**
|
||||
* @return \Symfony\Component\BrowserKit\AbstractBrowser
|
||||
*/
|
||||
private function getAuthenticatedClient(mixed $username = 'center a_social')
|
||||
private function getAuthenticatedClient(mixed $username = 'center a_social'): \Symfony\Bundle\FrameworkBundle\KernelBrowser
|
||||
{
|
||||
return self::createClient([], [
|
||||
'PHP_AUTH_USER' => $username,
|
||||
|
@@ -133,7 +133,7 @@ final class ReportVoterTest extends KernelTestCase
|
||||
$action,
|
||||
$message,
|
||||
?User $user = null,
|
||||
) {
|
||||
): void {
|
||||
$token = $this->prepareToken($user);
|
||||
$result = $this->voter->vote($token, $report, [$action]);
|
||||
$this->assertEquals($expectedResult, $result, $message);
|
||||
@@ -146,7 +146,7 @@ final class ReportVoterTest extends KernelTestCase
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
protected function preparePerson(Center $center)
|
||||
protected function preparePerson(Center $center): \Chill\PersonBundle\Entity\Person
|
||||
{
|
||||
return (new Person())
|
||||
->setCenter($center);
|
||||
|
@@ -87,7 +87,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
// static::$em->remove($this->report);
|
||||
}
|
||||
|
||||
public function testReportIsNotVisibleToUngrantedUsers()
|
||||
public function testReportIsNotVisibleToUngrantedUsers(): void
|
||||
{
|
||||
$client = self::createClient(
|
||||
[],
|
||||
@@ -108,7 +108,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
/**
|
||||
* Test that a report is shown in timeline.
|
||||
*/
|
||||
public function testTimelineReport()
|
||||
public function testTimelineReport(): void
|
||||
{
|
||||
$client = self::createClient(
|
||||
[],
|
||||
@@ -129,7 +129,7 @@ final class TimelineProviderTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testTimelineReportWithSummaryField()
|
||||
public function testTimelineReportWithSummaryField(): void
|
||||
{
|
||||
// load the page
|
||||
$client = self::createClient(
|
||||
|
@@ -27,7 +27,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
public function __construct(protected EntityManager $em, protected AuthorizationHelper $helper, private readonly Security $security, protected CustomFieldsHelper $customFieldsHelper, protected $showEmptyValues) {}
|
||||
|
||||
public function fetchQuery($context, array $args)
|
||||
public function fetchQuery($context, array $args): \Chill\MainBundle\Timeline\TimelineSingleQuery
|
||||
{
|
||||
$this->checkContext($context);
|
||||
|
||||
@@ -147,7 +147,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
*
|
||||
* @throws \LogicException if the context is not supported
|
||||
*/
|
||||
private function checkContext($context)
|
||||
private function checkContext($context): void
|
||||
{
|
||||
if ('person' !== $context && 'center' !== $context) {
|
||||
throw new \LogicException("The context '{$context}' is not supported. Currently only 'person' and 'center' is supported");
|
||||
|
@@ -37,7 +37,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI
|
||||
$this->addSql('ALTER TABLE Report DROP scope_id');
|
||||
}
|
||||
|
||||
public function setContainer(?ContainerInterface $container = null)
|
||||
public function setContainer(?ContainerInterface $container = null): void
|
||||
{
|
||||
if (null === $container) {
|
||||
throw new \RuntimeException('Container is not provided. This migration need container to set a default center');
|
||||
|
Reference in New Issue
Block a user