mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	upgrade phpunit: make data provider static
This commit is contained in:
		@@ -41,6 +41,12 @@ return static function (RectorConfig $rectorConfig): void {
 | 
			
		||||
        \Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    // migrate for phpunit
 | 
			
		||||
    $rectorConfig->rules([
 | 
			
		||||
        \Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector::class,
 | 
			
		||||
        \Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector::class
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    // some routes are added twice if it remains activated
 | 
			
		||||
    // $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ final class AsideActivityControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateAsideActivityId(): iterable
 | 
			
		||||
    public static function generateAsideActivityId(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ final class CalendarControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideAccompanyingPeriod(): iterable
 | 
			
		||||
    public static function provideAccompanyingPeriod(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ class MSUserAbsenceReaderTest extends TestCase
 | 
			
		||||
        self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataTestUserAbsence(): iterable
 | 
			
		||||
    public static function provideDataTestUserAbsence(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        // contains data that was retrieved from microsoft graph api on 2023-07-06
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ class MSUserAbsenceSyncTest extends TestCase
 | 
			
		||||
        self::assertEquals($expectedAbsenceStart, $user->getAbsenceStart(), $message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataTestSyncUserAbsence(): iterable
 | 
			
		||||
    public static function provideDataTestSyncUserAbsence(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [new User(), false, false, null, 'user present remains present'];
 | 
			
		||||
        yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent'];
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ final class DefaultRangeGeneratorTest extends TestCase
 | 
			
		||||
     * * Jeudi => envoi des rdv du samedi et dimanche
 | 
			
		||||
     * * Vendredi => Envoi des rdv du lundi.
 | 
			
		||||
     */
 | 
			
		||||
    public function generateData(): \Iterator
 | 
			
		||||
    public static function generateData(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        yield [
 | 
			
		||||
            new \DateTimeImmutable('2022-06-13 10:45:00'),
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function emptyDataProvider()
 | 
			
		||||
    public static function emptyDataProvider()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            // 0
 | 
			
		||||
@@ -101,7 +101,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function serializedRepresentationDataProvider()
 | 
			
		||||
    public static function serializedRepresentationDataProvider()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ final class DocGenEncoderTest extends TestCase
 | 
			
		||||
        $this->encoder = new DocGenEncoder();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateEncodeData()
 | 
			
		||||
    public static function generateEncodeData()
 | 
			
		||||
    {
 | 
			
		||||
        yield [['tests' => 'ok'], ['tests' => 'ok'], 'A simple test with a simple array'];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase
 | 
			
		||||
        self::assertGreaterThanOrEqual(20, strlen($signedUrl->prefix));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataProviderGenerate(): iterable
 | 
			
		||||
    public static function dataProviderGenerate(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $now = \DateTimeImmutable::createFromFormat('U', '1702041743');
 | 
			
		||||
        $expireDelay = 1800;
 | 
			
		||||
@@ -138,7 +138,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataProviderGeneratePost(): iterable
 | 
			
		||||
    public static function dataProviderGeneratePost(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $now = \DateTimeImmutable::createFromFormat('U', '1702041743');
 | 
			
		||||
        $expireDelay = 1800;
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ class AsyncUploadExtensionTest extends KernelTestCase
 | 
			
		||||
        self::assertEquals('url', $actual);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataProviderStoredObject(): iterable
 | 
			
		||||
    public static function dataProviderStoredObject(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [(new StoredObject())->setFilename('blabla')];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ class AccompanyingCourseDocumentGenericDocProviderTest extends KernelTestCase
 | 
			
		||||
        self::assertIsInt($nb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideSearchArguments(): iterable
 | 
			
		||||
    public static function provideSearchArguments(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [null, null, null];
 | 
			
		||||
        yield [new \DateTimeImmutable('1 month ago'), null, null];
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ class PersonDocumentGenericDocProviderTest extends KernelTestCase
 | 
			
		||||
        self::assertIsInt($nb, 'Test that the query is syntactically correct');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataBuildFetchQueryForPerson(): iterable
 | 
			
		||||
    public static function provideDataBuildFetchQueryForPerson(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [null, null, null];
 | 
			
		||||
        yield [new \DateTimeImmutable('1 year ago'), null, null];
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        yield [$period, new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), 'test'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataBuildFetchQueryForPerson(): iterable
 | 
			
		||||
    public static function provideDataBuildFetchQueryForPerson(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [null, null, null];
 | 
			
		||||
        yield [new \DateTimeImmutable('1 year ago'), null, null];
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
 | 
			
		||||
 */
 | 
			
		||||
final class StoredObjectManagerTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function getDataProvider(): \Generator
 | 
			
		||||
    public static function getDataProvider(): \Generator
 | 
			
		||||
    {
 | 
			
		||||
        /* HAPPY SCENARIO */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@ class EventACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        $this->assertIsArray($repository->findAllViewable($filters));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateFilters(): iterable
 | 
			
		||||
    public static function generateFilters(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [[]];
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateAddressIds(): iterable
 | 
			
		||||
    public static function generateAddressIds(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ final class AddressReferenceApiControllerTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    use PrepareClientTrait;
 | 
			
		||||
 | 
			
		||||
    public function provideData()
 | 
			
		||||
    public static function provideData()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        /** @var EntityManagerInterface $em */
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ final class SearchApiControllerTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    use PrepareClientTrait;
 | 
			
		||||
 | 
			
		||||
    public function generateSearchData()
 | 
			
		||||
    public static function generateSearchData()
 | 
			
		||||
    {
 | 
			
		||||
        yield ['per', ['person', 'thirdparty']];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ final class AgeTest extends KernelTestCase
 | 
			
		||||
        $this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateQueries(): iterable
 | 
			
		||||
    public static function generateQueries(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [
 | 
			
		||||
            'SELECT AGE(a.validFrom, a.validTo) FROM '.Address::class.' a',
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ class JsonBuildObjectTest extends KernelTestCase
 | 
			
		||||
        self::assertIsArray($result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideQueries(): iterable
 | 
			
		||||
    public static function provideQueries(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield ['SELECT JSON_BUILD_OBJECT(1, 2, 3, 4) FROM '.Address::class.' a', [], []];
 | 
			
		||||
        yield ["SELECT JSON_BUILD_OBJECT('st', a.street, 'sn', a.streetNumber) FROM ".Address::class.' a', [], []];
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ final class JsonExtractTest extends KernelTestCase
 | 
			
		||||
        $this->em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateDql(): iterable
 | 
			
		||||
    public static function dataGenerateDql(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM '.Country::class.' c', []];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ final class NotificationTest extends KernelTestCase
 | 
			
		||||
        $em->flush();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateNotificationData()
 | 
			
		||||
    public static function generateNotificationData()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $userRepository = self::getContainer()->get(UserRepository::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ final class PageTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function generateGetFirstItemNumber()
 | 
			
		||||
    public static function generateGetFirstItemNumber()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [1, 10, 0],
 | 
			
		||||
@@ -61,7 +61,7 @@ final class PageTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function generateGetLastItemNumber()
 | 
			
		||||
    public static function generateGetLastItemNumber()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [1, 10, 9],
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ final class PaginatorTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function generateHasNextPage()
 | 
			
		||||
    public static function generateHasNextPage()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [10, 10, 1, false],
 | 
			
		||||
@@ -53,7 +53,7 @@ final class PaginatorTest extends KernelTestCase
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateHasPage()
 | 
			
		||||
    public static function generateHasPage()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [10, 10, -1, false],
 | 
			
		||||
@@ -72,7 +72,7 @@ final class PaginatorTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function generateHasPreviousPage()
 | 
			
		||||
    public static function generateHasPreviousPage()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [10, 10, 1, false],
 | 
			
		||||
@@ -88,7 +88,7 @@ final class PaginatorTest extends KernelTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function generatePageNumber()
 | 
			
		||||
    public static function generatePageNumber()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [12, 10, 2],
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
 | 
			
		||||
 */
 | 
			
		||||
final class PhonenumberHelperTest extends KernelTestCase
 | 
			
		||||
{
 | 
			
		||||
    public function formatPhonenumbers()
 | 
			
		||||
    public static function formatPhonenumbers()
 | 
			
		||||
    {
 | 
			
		||||
        yield [
 | 
			
		||||
            'BE',
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
 | 
			
		||||
 */
 | 
			
		||||
final class ExtractDateFromPatternTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function provideSubjects()
 | 
			
		||||
    public static function provideSubjects()
 | 
			
		||||
    {
 | 
			
		||||
        yield ['15/06/1981', '', 1, '1981-06-15'];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
 | 
			
		||||
 */
 | 
			
		||||
final class ExtractPhonenumberFromPatternTest extends KernelTestCase
 | 
			
		||||
{
 | 
			
		||||
    public function provideData()
 | 
			
		||||
    public static function provideData()
 | 
			
		||||
    {
 | 
			
		||||
        yield ['BE', 'Diallo', 0, [], 'Diallo', 'no phonenumber'];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ final class DateNormalizerTest extends KernelTestCase
 | 
			
		||||
        $this->prophet = new Prophet();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateDataNormalize()
 | 
			
		||||
    public static function generateDataNormalize()
 | 
			
		||||
    {
 | 
			
		||||
        $datetime = \DateTime::createFromFormat('Y-m-d H:i:sO', '2021-06-05 15:05:01+02:00');
 | 
			
		||||
        $date = \DateTime::createFromFormat('Y-m-d H:i:sO', '2021-06-05 00:00:00+02:00');
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase
 | 
			
		||||
        $this->normalizer = new DoctrineExistingEntityNormalizer($em, $serializerFactory);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataProviderUserId()
 | 
			
		||||
    public static function dataProviderUserId()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ final class PhonenumberNormalizerTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    use ProphecyTrait;
 | 
			
		||||
 | 
			
		||||
    public function dataProviderNormalizePhonenumber()
 | 
			
		||||
    public static function dataProviderNormalizePhonenumber()
 | 
			
		||||
    {
 | 
			
		||||
        $phonenumberUtil = PhoneNumberUtil::getInstance();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ final class UserNormalizerTest extends TestCase
 | 
			
		||||
    /**
 | 
			
		||||
     * @throws NumberParseException
 | 
			
		||||
     */
 | 
			
		||||
    public function dataProviderUserNormalizer()
 | 
			
		||||
    public static function dataProviderUserNormalizer()
 | 
			
		||||
    {
 | 
			
		||||
        $user = new User();
 | 
			
		||||
        $userNoPhone = new User();
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ final class RollingDateConverterTest extends TestCase
 | 
			
		||||
        $this->converter = new RollingDateConverter();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateDataConversionDate(): iterable
 | 
			
		||||
    public static function generateDataConversionDate(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $format = 'Y-m-d His';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addressDataProviderBEWithBuilding(): \Iterator
 | 
			
		||||
    public static function addressDataProviderBEWithBuilding(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -50,7 +50,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addressDataProviderBEWithSteps(): \Iterator
 | 
			
		||||
    public static function addressDataProviderBEWithSteps(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -70,7 +70,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addressDataProviderFRWithBuilding(): \Iterator
 | 
			
		||||
    public static function addressDataProviderFRWithBuilding(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -90,7 +90,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addressDataProviderFRWithSteps(): \Iterator
 | 
			
		||||
    public static function addressDataProviderFRWithSteps(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -110,7 +110,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function complexAddressDataProviderBE(): \Iterator
 | 
			
		||||
    public static function complexAddressDataProviderBE(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -134,7 +134,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function complexAddressDataProviderFR(): \Iterator
 | 
			
		||||
    public static function complexAddressDataProviderFR(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -160,7 +160,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 — Résidence "Les Bleuets" — 5, Rue ABC — A droite de la porte — 012345 Locality CEDEX — France'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function noFullAddressDataProviderBE(): \Iterator
 | 
			
		||||
    public static function noFullAddressDataProviderBE(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -177,7 +177,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, '012345 Locality — Belgium'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function simpleAddressDataProviderBE(): \Iterator
 | 
			
		||||
    public static function simpleAddressDataProviderBE(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
@@ -195,7 +195,7 @@ final class AddressRenderTest extends KernelTestCase
 | 
			
		||||
        yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function simpleAddressDataProviderFR(): \Iterator
 | 
			
		||||
    public static function simpleAddressDataProviderFR(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $addr = new Address();
 | 
			
		||||
        $country = (new Country())
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ class AccompanyingPeriodStepChangeCronjobTest extends TestCase
 | 
			
		||||
        $this->assertEquals($canRun, $cronJob->canRun($cronJobExecution));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideRunTimes(): iterable
 | 
			
		||||
    public static function provideRunTimes(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        // can run, during the night
 | 
			
		||||
        yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-14T00:00:00+02:00'), true];
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@ class ConflictTest extends WebTestCase
 | 
			
		||||
        self::assertResponseStatusCodeSame(409);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateAccompanyingPeriodWork(): iterable
 | 
			
		||||
    public static function generateAccompanyingPeriodWork(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateNewAccompanyingCourse()
 | 
			
		||||
    public static function dataGenerateNewAccompanyingCourse()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
@@ -85,7 +85,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateRandomAccompanyingCourse()
 | 
			
		||||
    public static function dataGenerateRandomAccompanyingCourse()
 | 
			
		||||
    {
 | 
			
		||||
        // note about max result for person query, and maxGenerated:
 | 
			
		||||
        //
 | 
			
		||||
@@ -152,7 +152,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateRandomAccompanyingCourseWithSocialIssue()
 | 
			
		||||
    public static function dataGenerateRandomAccompanyingCourseWithSocialIssue()
 | 
			
		||||
    {
 | 
			
		||||
        // note about max result for person query, and maxGenerated:
 | 
			
		||||
        //
 | 
			
		||||
@@ -224,7 +224,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateRandomRequestorValidData(): \Iterator
 | 
			
		||||
    public static function dataGenerateRandomRequestorValidData(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $dataLength = 2;
 | 
			
		||||
        $maxResults = 100;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGenerateRandomUsers(): \Iterator
 | 
			
		||||
    public static function dataGenerateRandomUsers(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ final class HouseholdApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateHouseholdId()
 | 
			
		||||
    public static function generateHouseholdId()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
@@ -124,7 +124,7 @@ final class HouseholdApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generatePersonId()
 | 
			
		||||
    public static function generatePersonId()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ final class HouseholdControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateValidHouseholdIds()
 | 
			
		||||
    public static function generateValidHouseholdIds()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    use PrepareClientTrait;
 | 
			
		||||
 | 
			
		||||
    public function provideValidDataEditMember(): \Iterator
 | 
			
		||||
    public static function provideValidDataEditMember(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
@@ -48,7 +48,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
 | 
			
		||||
        yield [\array_pop($membershipIds)['id']];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideValidDataMove(): \Iterator
 | 
			
		||||
    public static function provideValidDataMove(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ final class PersonApiControllerTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    use PrepareClientTrait;
 | 
			
		||||
 | 
			
		||||
    public function dataGetPersonFromCenterA(): \Iterator
 | 
			
		||||
    public static function dataGetPersonFromCenterA(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
@@ -49,7 +49,7 @@ final class PersonApiControllerTest extends WebTestCase
 | 
			
		||||
        yield \array_pop($personIds);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGetPersonFromCenterB(): \Iterator
 | 
			
		||||
    public static function dataGetPersonFromCenterB(): \Iterator
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -188,7 +188,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed[]
 | 
			
		||||
     */
 | 
			
		||||
    public function validTextFieldsProvider()
 | 
			
		||||
    public static function validTextFieldsProvider()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            ['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
 | 
			
		||||
 */
 | 
			
		||||
final class PersonDuplicateControllerViewTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    public function providePersonData(): iterable
 | 
			
		||||
    public static function providePersonData(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ final class RelationshipApiControllerTest extends WebTestCase
 | 
			
		||||
        self::ensureKernelShutdown();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function personProvider(): array
 | 
			
		||||
    public static function personProvider(): array
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
 | 
			
		||||
 */
 | 
			
		||||
final class PersonCreateEventTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function generateAltNames(): iterator
 | 
			
		||||
    public static function generateAltNames(): iterator
 | 
			
		||||
    {
 | 
			
		||||
        yield ['vinCENT', 'VINCENT'];
 | 
			
		||||
 | 
			
		||||
@@ -32,7 +32,7 @@ final class PersonCreateEventTest extends TestCase
 | 
			
		||||
        yield ['émile', 'ÉMILE'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateNames(): iterator
 | 
			
		||||
    public static function generateNames(): iterator
 | 
			
		||||
    {
 | 
			
		||||
        yield ['émelie-marie', 'Émelie-Marie', 'lenaerts', 'LENAERTS'];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest
 | 
			
		||||
        return $this->filter;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getFormData(): array
 | 
			
		||||
    public static function getFormData(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            [
 | 
			
		||||
@@ -47,7 +47,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getQueryBuilders(): array
 | 
			
		||||
    public static function getQueryBuilders(): array
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -90,10 +90,11 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
 | 
			
		||||
        self::assertIsArray($result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataProviderTestAddFilterAccompanyingPeriod(): iterable
 | 
			
		||||
    public static function dataProviderTestAddFilterAccompanyingPeriod(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::setUp();
 | 
			
		||||
        $qb = $this->entityManager->createQueryBuilder();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
        $qb = $entityManager->createQueryBuilder();
 | 
			
		||||
 | 
			
		||||
        $qb
 | 
			
		||||
            ->select('acp.id')
 | 
			
		||||
 
 | 
			
		||||
@@ -140,20 +140,23 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataFindByUserAndPostalCodesOpenedAccompanyingPeriod(): iterable
 | 
			
		||||
    public static function provideDataFindByUserAndPostalCodesOpenedAccompanyingPeriod(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
        $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class);
 | 
			
		||||
        $centerRepository = self::getContainer()->get(CenterRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
        if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
        if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $persons = $this->entityManager
 | 
			
		||||
        $persons = $entityManager
 | 
			
		||||
            ->createQuery('SELECT p FROM '.Person::class.' p JOIN p.centerCurrent current_center')
 | 
			
		||||
            ->setMaxResults(4)
 | 
			
		||||
            ->getResult();
 | 
			
		||||
@@ -165,7 +168,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        /** @var Person $person */
 | 
			
		||||
        [$person, $anotherPerson, $person2, $person3] = $persons;
 | 
			
		||||
 | 
			
		||||
        $scopes = $this->scopeRepository->findAll();
 | 
			
		||||
        $scopes = $scopeRepository->findAll();
 | 
			
		||||
 | 
			
		||||
        if (3 > count($scopes)) {
 | 
			
		||||
            throw new \RuntimeException('not enough scopes for this test');
 | 
			
		||||
@@ -173,14 +176,14 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        $scopesCanSee = [$scopes[0]];
 | 
			
		||||
        $scopesGroup2 = [$scopes[1]];
 | 
			
		||||
 | 
			
		||||
        $centers = $this->centerRepository->findActive();
 | 
			
		||||
        $centers = $centerRepository->findActive();
 | 
			
		||||
        $aCenterNotAssociatedToPerson = array_values(array_filter($centers, fn (Center $c) => $c !== $person->getCenter()))[0];
 | 
			
		||||
 | 
			
		||||
        if (2 > count($centers)) {
 | 
			
		||||
            throw new \RuntimeException('not enough centers for this test');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $period = $this->buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
        $period = self::buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
        $period->setUser($user);
 | 
			
		||||
 | 
			
		||||
        yield [
 | 
			
		||||
@@ -233,7 +236,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
            'period should not be visible for user having right in another scope (with multiple centers)',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $period = $this->buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
        $period = self::buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
        $period->setUser($user);
 | 
			
		||||
        $period->setConfidential(true);
 | 
			
		||||
 | 
			
		||||
@@ -267,7 +270,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
            'period confidential be visible if user has required scopes',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->entityManager->flush();
 | 
			
		||||
        $entityManager->flush();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -314,21 +317,24 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataFindByUndispatched(): iterable
 | 
			
		||||
    public static function provideDataFindByUndispatched(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
        $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class);
 | 
			
		||||
        $centerRepository = self::getContainer()->get(CenterRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
        if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
        if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /** @var Person $person */
 | 
			
		||||
        $persons = $this->entityManager
 | 
			
		||||
        $persons = $entityManager
 | 
			
		||||
            ->createQuery('SELECT p FROM '.Person::class.' p ')
 | 
			
		||||
            ->setMaxResults(4)
 | 
			
		||||
            ->getResult();
 | 
			
		||||
@@ -339,7 +345,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
 | 
			
		||||
        [$person, $anotherPerson, $person2, $person3] = $persons;
 | 
			
		||||
 | 
			
		||||
        $scopes = $this->scopeRepository->findAll();
 | 
			
		||||
        $scopes = $scopeRepository->findAll();
 | 
			
		||||
 | 
			
		||||
        if (3 > count($scopes)) {
 | 
			
		||||
            throw new \RuntimeException('not enough scopes for this test');
 | 
			
		||||
@@ -347,13 +353,13 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        $scopesCanSee = [$scopes[0]];
 | 
			
		||||
        $scopesGroup2 = [$scopes[1]];
 | 
			
		||||
 | 
			
		||||
        $centers = $this->centerRepository->findActive();
 | 
			
		||||
        $centers = $centerRepository->findActive();
 | 
			
		||||
 | 
			
		||||
        if (2 > count($centers)) {
 | 
			
		||||
            throw new \RuntimeException('not enough centers for this test');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $period = $this->buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
        $period = self::buildPeriod($person, $scopesCanSee, $user, true);
 | 
			
		||||
 | 
			
		||||
        // expected scope: can see the period
 | 
			
		||||
        yield [
 | 
			
		||||
@@ -405,7 +411,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
            'period should not be visible for user having right in another scope (with multiple centers)',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->entityManager->flush();
 | 
			
		||||
        $entityManager->flush();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -445,20 +451,22 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataForFindByPerson(): iterable
 | 
			
		||||
    public static function provideDataForFindByPerson(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
        $scopeRepository = self::getContainer()->get(ScopeRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $user = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
        if (null === $user = $entityManager->createQuery('SELECT u FROM '.User::class.' u')->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null === $anotherUser = $this->entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
        if (null === $anotherUser = $entityManager->createQuery('SELECT u FROM '.User::class.' u WHERE u.id != :uid')->setParameter('uid', $user->getId())
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('no user found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null === $centerA = $this->entityManager->createQuery('SELECT c FROM '.Center::class.' c WHERE c.name LIKE :cn')->setParameter('cn', 'Center A')
 | 
			
		||||
        if (null === $centerA = $entityManager->createQuery('SELECT c FROM '.Center::class.' c WHERE c.name LIKE :cn')->setParameter('cn', 'Center A')
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('Center A not found');
 | 
			
		||||
        }
 | 
			
		||||
@@ -473,13 +481,13 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
                ->setBirthdate((new \DateTime('today'))->sub(new \DateInterval('P'.random_int(18, 100).'Y')))
 | 
			
		||||
                ->setCenter($centerA)
 | 
			
		||||
            ;
 | 
			
		||||
            $this->entityManager->persist($p);
 | 
			
		||||
            $entityManager->persist($p);
 | 
			
		||||
            self::$entitiesToDelete[] = [Person::class, $p->getId()];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [$person, $anotherPerson, $person2, $person3] = $persons;
 | 
			
		||||
 | 
			
		||||
        $scopes = $this->scopeRepository->findAll();
 | 
			
		||||
        $scopes = $scopeRepository->findAll();
 | 
			
		||||
 | 
			
		||||
        if (3 > count($scopes)) {
 | 
			
		||||
            throw new \RuntimeException('not enough scopes for this test');
 | 
			
		||||
@@ -488,7 +496,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        $scopesGroup2 = [$scopes[1]];
 | 
			
		||||
 | 
			
		||||
        // case: a period is in draft state
 | 
			
		||||
        $period = $this->buildPeriod($person, $scopesCanSee, $user, false);
 | 
			
		||||
        $period = self::buildPeriod($person, $scopesCanSee, $user, false);
 | 
			
		||||
 | 
			
		||||
        yield [$user, $person, $scopesCanSee, [], [$period], 'a user can see his period during draft state'];
 | 
			
		||||
 | 
			
		||||
@@ -496,7 +504,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        yield [$anotherUser, $person, $scopesCanSee, [], [], 'another user is not allowed to see the period of someone else in draft state'];
 | 
			
		||||
 | 
			
		||||
        // the period is confirmed
 | 
			
		||||
        $period = $this->buildPeriod($anotherPerson, $scopesCanSee, $user, true);
 | 
			
		||||
        $period = self::buildPeriod($anotherPerson, $scopesCanSee, $user, true);
 | 
			
		||||
 | 
			
		||||
        // the other user can now see it
 | 
			
		||||
        yield [$user, $anotherPerson, $scopesCanSee, [], [$period], 'a user see his period when confirmed'];
 | 
			
		||||
@@ -504,7 +512,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        yield [$anotherUser, $anotherPerson, $scopesGroup2, [], [], 'another user without the required scopes is not allowed to see the period when not draft'];
 | 
			
		||||
 | 
			
		||||
        // this period will be confidential
 | 
			
		||||
        $period = $this->buildPeriod($person2, $scopesCanSee, $user, true);
 | 
			
		||||
        $period = self::buildPeriod($person2, $scopesCanSee, $user, true);
 | 
			
		||||
        $period->setConfidential(true)->setUser($user, true);
 | 
			
		||||
 | 
			
		||||
        yield [$user, $person2, $scopesCanSee, [], [$period], 'a user see his period when confirmed and confidential with required scopes'];
 | 
			
		||||
@@ -513,16 +521,19 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
        yield [$anotherUser, $person2, $scopesCanSee, $scopesCanSee, [$period], 'a user see the period when confirmed and confidential if he has required scope to see the period'];
 | 
			
		||||
 | 
			
		||||
        // period draft with creator = null
 | 
			
		||||
        $period = $this->buildPeriod($person3, $scopesCanSee, null, false);
 | 
			
		||||
        $period = self::buildPeriod($person3, $scopesCanSee, null, false);
 | 
			
		||||
        yield [$user, $person3, $scopesCanSee, [], [$period], 'a user see a period when draft if no creator on the period'];
 | 
			
		||||
        $this->entityManager->flush();
 | 
			
		||||
        $entityManager->flush();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array<Scope> $scopes
 | 
			
		||||
     */
 | 
			
		||||
    private function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod
 | 
			
		||||
    private static function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod
 | 
			
		||||
    {
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
        $registry = self::getContainer()->get(Registry::class);
 | 
			
		||||
 | 
			
		||||
        $period = new AccompanyingPeriod();
 | 
			
		||||
        $period->addPerson($person);
 | 
			
		||||
        if (null !== $creator) {
 | 
			
		||||
@@ -533,11 +544,11 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
 | 
			
		||||
            $period->addScope($scope);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->entityManager->persist($period);
 | 
			
		||||
        $entityManager->persist($period);
 | 
			
		||||
        self::$periodsIdsToDelete[] = $period->getId();
 | 
			
		||||
 | 
			
		||||
        if ($confirm) {
 | 
			
		||||
            $workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
 | 
			
		||||
            $workflow = $registry->get($period, 'accompanying_period_lifecycle');
 | 
			
		||||
            $workflow->apply($period, 'confirm');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
 | 
			
		||||
        $this->normalizer = self::getContainer()->get(NormalizerInterface::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable
 | 
			
		||||
    public static function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read']]];
 | 
			
		||||
 | 
			
		||||
@@ -88,7 +88,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
 | 
			
		||||
        yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read'], 'docgen:person:with-budget' => true]];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function generateData()
 | 
			
		||||
    public static function generateData()
 | 
			
		||||
    {
 | 
			
		||||
        $person = new Person();
 | 
			
		||||
        $person
 | 
			
		||||
 
 | 
			
		||||
@@ -124,7 +124,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
 | 
			
		||||
        call_user_func($assertionsOnData, $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideNormalizedData(): iterable
 | 
			
		||||
    public static function provideNormalizedData(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ final class PersonContextTest extends KernelTestCase
 | 
			
		||||
        call_user_func($assertionsOnData, $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideNormalizedData(): iterable
 | 
			
		||||
    public static function provideNormalizedData(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $em = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -99,11 +99,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase
 | 
			
		||||
        self::assertStringContainsStringIgnoringCase('TRUE = FALSE', $sql);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataForPerson(): iterable
 | 
			
		||||
    public static function provideDataForPerson(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p WHERE SIZE(p.accompanyingPeriodParticipations) > 0')
 | 
			
		||||
        if (null === $person = $entityManager->createQuery('SELECT p FROM '.Person::class.' p WHERE SIZE(p.accompanyingPeriodParticipations) > 0')
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('There is no person');
 | 
			
		||||
        }
 | 
			
		||||
@@ -116,11 +117,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase
 | 
			
		||||
        yield [$person, null, new \DateTimeImmutable('6 month ago'), null];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataForAccompanyingPeriod(): iterable
 | 
			
		||||
    public static function provideDataForAccompanyingPeriod(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $period = $this->entityManager->createQuery('SELECT p FROM '.AccompanyingPeriod::class.' p ')
 | 
			
		||||
        if (null === $period = $entityManager->createQuery('SELECT p FROM '.AccompanyingPeriod::class.' p ')
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('There is no accompanying period');
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ class AccompanyingPeriodWorkEvaluationGenericDocProviderTest extends KernelTestC
 | 
			
		||||
        self::assertIsInt($nb, 'Test that there are no errors');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideSearchArguments(): iterable
 | 
			
		||||
    public static function provideSearchArguments(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        yield [null, null, null];
 | 
			
		||||
        yield [new \DateTimeImmutable('1 month ago'), null, null];
 | 
			
		||||
 
 | 
			
		||||
@@ -52,11 +52,12 @@ class PersonCalendarGenericDocProviderTest extends KernelTestCase
 | 
			
		||||
        self::assertIsInt($nb);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideDataForPerson(): iterable
 | 
			
		||||
    public static function provideDataForPerson(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $this->setUp();
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
        $entityManager = self::getContainer()->get(EntityManagerInterface::class);
 | 
			
		||||
 | 
			
		||||
        if (null === $person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p ')
 | 
			
		||||
        if (null === $person = $entityManager->createQuery('SELECT p FROM '.Person::class.' p ')
 | 
			
		||||
            ->setMaxResults(1)->getSingleResult()) {
 | 
			
		||||
            throw new \RuntimeException('There is no person');
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ class ClosingMotiveRenderTest extends KernelTestCase
 | 
			
		||||
        self::assertStringContainsString($expectedContent, $actual);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function provideClosingMotiveWithRenderString(): iterable
 | 
			
		||||
    public static function provideClosingMotiveWithRenderString(): iterable
 | 
			
		||||
    {
 | 
			
		||||
        $closingMotive = (new ClosingMotive())->setName(['fr' => 'Left']);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase
 | 
			
		||||
{
 | 
			
		||||
    use PrepareClientTrait;
 | 
			
		||||
 | 
			
		||||
    public function provideDataPersonWithAccompanyingPeriod()
 | 
			
		||||
    public static function provideDataPersonWithAccompanyingPeriod()
 | 
			
		||||
    {
 | 
			
		||||
        self::bootKernel();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
 | 
			
		||||
 */
 | 
			
		||||
final class MaxHolderValidatorTest extends ConstraintValidatorTestCase
 | 
			
		||||
{
 | 
			
		||||
    public function provideInvalidHousehold()
 | 
			
		||||
    public static function provideInvalidHousehold()
 | 
			
		||||
    {
 | 
			
		||||
        $household = new Household();
 | 
			
		||||
        $position = (new Position())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user