upgrade phpunit: make data provider static

This commit is contained in:
Julien Fastré 2024-02-14 12:28:14 +01:00
parent d5115b3718
commit f251e6f100
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
57 changed files with 142 additions and 121 deletions

View File

@ -41,6 +41,12 @@ return static function (RectorConfig $rectorConfig): void {
\Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90, \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 // some routes are added twice if it remains activated
// $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class); // $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class);

View File

@ -30,7 +30,7 @@ final class AsideActivityControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function generateAsideActivityId(): iterable public static function generateAsideActivityId(): iterable
{ {
self::bootKernel(); self::bootKernel();

View File

@ -42,7 +42,7 @@ final class CalendarControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function provideAccompanyingPeriod(): iterable public static function provideAccompanyingPeriod(): iterable
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -59,7 +59,7 @@ class MSUserAbsenceReaderTest extends TestCase
self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null'); 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 // contains data that was retrieved from microsoft graph api on 2023-07-06

View File

@ -46,7 +46,7 @@ class MSUserAbsenceSyncTest extends TestCase
self::assertEquals($expectedAbsenceStart, $user->getAbsenceStart(), $message); 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(), false, false, null, 'user present remains present'];
yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent']; yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent'];

View File

@ -35,7 +35,7 @@ final class DefaultRangeGeneratorTest extends TestCase
* * Jeudi => envoi des rdv du samedi et dimanche * * Jeudi => envoi des rdv du samedi et dimanche
* * Vendredi => Envoi des rdv du lundi. * * Vendredi => Envoi des rdv du lundi.
*/ */
public function generateData(): \Iterator public static function generateData(): \Iterator
{ {
yield [ yield [
new \DateTimeImmutable('2022-06-13 10:45:00'), new \DateTimeImmutable('2022-06-13 10:45:00'),

View File

@ -55,7 +55,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function emptyDataProvider() public static function emptyDataProvider()
{ {
return [ return [
// 0 // 0
@ -101,7 +101,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
]; ];
} }
public function serializedRepresentationDataProvider() public static function serializedRepresentationDataProvider()
{ {
return [ return [
[ [

View File

@ -31,7 +31,7 @@ final class DocGenEncoderTest extends TestCase
$this->encoder = new DocGenEncoder(); $this->encoder = new DocGenEncoder();
} }
public function generateEncodeData() public static function generateEncodeData()
{ {
yield [['tests' => 'ok'], ['tests' => 'ok'], 'A simple test with a simple array']; yield [['tests' => 'ok'], ['tests' => 'ok'], 'A simple test with a simple array'];

View File

@ -107,7 +107,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase
self::assertGreaterThanOrEqual(20, strlen($signedUrl->prefix)); self::assertGreaterThanOrEqual(20, strlen($signedUrl->prefix));
} }
public function dataProviderGenerate(): iterable public static function dataProviderGenerate(): iterable
{ {
$now = \DateTimeImmutable::createFromFormat('U', '1702041743'); $now = \DateTimeImmutable::createFromFormat('U', '1702041743');
$expireDelay = 1800; $expireDelay = 1800;
@ -138,7 +138,7 @@ class TempUrlOpenstackGeneratorTest extends TestCase
} }
} }
public function dataProviderGeneratePost(): iterable public static function dataProviderGeneratePost(): iterable
{ {
$now = \DateTimeImmutable::createFromFormat('U', '1702041743'); $now = \DateTimeImmutable::createFromFormat('U', '1702041743');
$expireDelay = 1800; $expireDelay = 1800;

View File

@ -68,7 +68,7 @@ class AsyncUploadExtensionTest extends KernelTestCase
self::assertEquals('url', $actual); self::assertEquals('url', $actual);
} }
public function dataProviderStoredObject(): iterable public static function dataProviderStoredObject(): iterable
{ {
yield [(new StoredObject())->setFilename('blabla')]; yield [(new StoredObject())->setFilename('blabla')];

View File

@ -69,7 +69,7 @@ class AccompanyingCourseDocumentGenericDocProviderTest extends KernelTestCase
self::assertIsInt($nb); self::assertIsInt($nb);
} }
public function provideSearchArguments(): iterable public static function provideSearchArguments(): iterable
{ {
yield [null, null, null]; yield [null, null, null];
yield [new \DateTimeImmutable('1 month ago'), null, null]; yield [new \DateTimeImmutable('1 month ago'), null, null];

View File

@ -73,7 +73,7 @@ class PersonDocumentGenericDocProviderTest extends KernelTestCase
self::assertIsInt($nb, 'Test that the query is syntactically correct'); self::assertIsInt($nb, 'Test that the query is syntactically correct');
} }
public function provideDataBuildFetchQueryForPerson(): iterable public static function provideDataBuildFetchQueryForPerson(): iterable
{ {
yield [null, null, null]; yield [null, null, null];
yield [new \DateTimeImmutable('1 year ago'), null, null]; yield [new \DateTimeImmutable('1 year ago'), null, null];

View File

@ -142,7 +142,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
yield [$period, new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), 'test']; 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 [null, null, null];
yield [new \DateTimeImmutable('1 year ago'), null, null]; yield [new \DateTimeImmutable('1 year ago'), null, null];

View File

@ -31,7 +31,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
*/ */
final class StoredObjectManagerTest extends TestCase final class StoredObjectManagerTest extends TestCase
{ {
public function getDataProvider(): \Generator public static function getDataProvider(): \Generator
{ {
/* HAPPY SCENARIO */ /* HAPPY SCENARIO */

View File

@ -60,7 +60,7 @@ class EventACLAwareRepositoryTest extends KernelTestCase
$this->assertIsArray($repository->findAllViewable($filters)); $this->assertIsArray($repository->findAllViewable($filters));
} }
public function generateFilters(): iterable public static function generateFilters(): iterable
{ {
yield [[]]; yield [[]];
} }

View File

@ -32,7 +32,7 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function generateAddressIds(): iterable public static function generateAddressIds(): iterable
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -25,7 +25,7 @@ final class AddressReferenceApiControllerTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
public function provideData() public static function provideData()
{ {
self::bootKernel(); self::bootKernel();
/** @var EntityManagerInterface $em */ /** @var EntityManagerInterface $em */

View File

@ -24,7 +24,7 @@ final class SearchApiControllerTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
public function generateSearchData() public static function generateSearchData()
{ {
yield ['per', ['person', 'thirdparty']]; yield ['per', ['person', 'thirdparty']];

View File

@ -31,7 +31,7 @@ final class AgeTest extends KernelTestCase
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class); $this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
} }
public function generateQueries(): iterable public static function generateQueries(): iterable
{ {
yield [ yield [
'SELECT AGE(a.validFrom, a.validTo) FROM '.Address::class.' a', 'SELECT AGE(a.validFrom, a.validTo) FROM '.Address::class.' a',

View File

@ -51,7 +51,7 @@ class JsonBuildObjectTest extends KernelTestCase
self::assertIsArray($result); 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(1, 2, 3, 4) FROM '.Address::class.' a', [], []];
yield ["SELECT JSON_BUILD_OBJECT('st', a.street, 'sn', a.streetNumber) FROM ".Address::class.' a', [], []]; yield ["SELECT JSON_BUILD_OBJECT('st', a.street, 'sn', a.streetNumber) FROM ".Address::class.' a', [], []];

View File

@ -31,7 +31,7 @@ final class JsonExtractTest extends KernelTestCase
$this->em = self::getContainer()->get(EntityManagerInterface::class); $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', []]; yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM '.Country::class.' c', []];

View File

@ -44,7 +44,7 @@ final class NotificationTest extends KernelTestCase
$em->flush(); $em->flush();
} }
public function generateNotificationData() public static function generateNotificationData()
{ {
self::bootKernel(); self::bootKernel();
$userRepository = self::getContainer()->get(UserRepository::class); $userRepository = self::getContainer()->get(UserRepository::class);

View File

@ -43,7 +43,7 @@ final class PageTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function generateGetFirstItemNumber() public static function generateGetFirstItemNumber()
{ {
return [ return [
[1, 10, 0], [1, 10, 0],
@ -61,7 +61,7 @@ final class PageTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function generateGetLastItemNumber() public static function generateGetLastItemNumber()
{ {
return [ return [
[1, 10, 9], [1, 10, 9],

View File

@ -43,7 +43,7 @@ final class PaginatorTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function generateHasNextPage() public static function generateHasNextPage()
{ {
return [ return [
[10, 10, 1, false], [10, 10, 1, false],
@ -53,7 +53,7 @@ final class PaginatorTest extends KernelTestCase
]; ];
} }
public function generateHasPage() public static function generateHasPage()
{ {
return [ return [
[10, 10, -1, false], [10, 10, -1, false],
@ -72,7 +72,7 @@ final class PaginatorTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function generateHasPreviousPage() public static function generateHasPreviousPage()
{ {
return [ return [
[10, 10, 1, false], [10, 10, 1, false],
@ -88,7 +88,7 @@ final class PaginatorTest extends KernelTestCase
* *
* @return array * @return array
*/ */
public function generatePageNumber() public static function generatePageNumber()
{ {
return [ return [
[12, 10, 2], [12, 10, 2],

View File

@ -25,7 +25,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
*/ */
final class PhonenumberHelperTest extends KernelTestCase final class PhonenumberHelperTest extends KernelTestCase
{ {
public function formatPhonenumbers() public static function formatPhonenumbers()
{ {
yield [ yield [
'BE', 'BE',

View File

@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/ */
final class ExtractDateFromPatternTest extends TestCase final class ExtractDateFromPatternTest extends TestCase
{ {
public function provideSubjects() public static function provideSubjects()
{ {
yield ['15/06/1981', '', 1, '1981-06-15']; yield ['15/06/1981', '', 1, '1981-06-15'];

View File

@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
*/ */
final class ExtractPhonenumberFromPatternTest extends KernelTestCase final class ExtractPhonenumberFromPatternTest extends KernelTestCase
{ {
public function provideData() public static function provideData()
{ {
yield ['BE', 'Diallo', 0, [], 'Diallo', 'no phonenumber']; yield ['BE', 'Diallo', 0, [], 'Diallo', 'no phonenumber'];

View File

@ -32,7 +32,7 @@ final class DateNormalizerTest extends KernelTestCase
$this->prophet = new Prophet(); $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'); $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'); $date = \DateTime::createFromFormat('Y-m-d H:i:sO', '2021-06-05 00:00:00+02:00');

View File

@ -35,7 +35,7 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase
$this->normalizer = new DoctrineExistingEntityNormalizer($em, $serializerFactory); $this->normalizer = new DoctrineExistingEntityNormalizer($em, $serializerFactory);
} }
public function dataProviderUserId() public static function dataProviderUserId()
{ {
self::bootKernel(); self::bootKernel();

View File

@ -28,7 +28,7 @@ final class PhonenumberNormalizerTest extends TestCase
{ {
use ProphecyTrait; use ProphecyTrait;
public function dataProviderNormalizePhonenumber() public static function dataProviderNormalizePhonenumber()
{ {
$phonenumberUtil = PhoneNumberUtil::getInstance(); $phonenumberUtil = PhoneNumberUtil::getInstance();

View File

@ -40,7 +40,7 @@ final class UserNormalizerTest extends TestCase
/** /**
* @throws NumberParseException * @throws NumberParseException
*/ */
public function dataProviderUserNormalizer() public static function dataProviderUserNormalizer()
{ {
$user = new User(); $user = new User();
$userNoPhone = new User(); $userNoPhone = new User();

View File

@ -29,7 +29,7 @@ final class RollingDateConverterTest extends TestCase
$this->converter = new RollingDateConverter(); $this->converter = new RollingDateConverter();
} }
public function generateDataConversionDate(): iterable public static function generateDataConversionDate(): iterable
{ {
$format = 'Y-m-d His'; $format = 'Y-m-d His';

View File

@ -30,7 +30,7 @@ final class AddressRenderTest extends KernelTestCase
self::bootKernel(); self::bootKernel();
} }
public function addressDataProviderBEWithBuilding(): \Iterator public static function addressDataProviderBEWithBuilding(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -50,7 +50,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium']; yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium'];
} }
public function addressDataProviderBEWithSteps(): \Iterator public static function addressDataProviderBEWithSteps(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -70,7 +70,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium']; yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
} }
public function addressDataProviderFRWithBuilding(): \Iterator public static function addressDataProviderFRWithBuilding(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -90,7 +90,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France']; yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France'];
} }
public function addressDataProviderFRWithSteps(): \Iterator public static function addressDataProviderFRWithSteps(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -110,7 +110,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France']; yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France'];
} }
public function complexAddressDataProviderBE(): \Iterator public static function complexAddressDataProviderBE(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $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']; 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(); $addr = new Address();
$country = (new Country()) $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']; 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(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -177,7 +177,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, '012345 Locality — Belgium']; yield [$addr, '012345 Locality — Belgium'];
} }
public function simpleAddressDataProviderBE(): \Iterator public static function simpleAddressDataProviderBE(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())
@ -195,7 +195,7 @@ final class AddressRenderTest extends KernelTestCase
yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium']; yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium'];
} }
public function simpleAddressDataProviderFR(): \Iterator public static function simpleAddressDataProviderFR(): \Iterator
{ {
$addr = new Address(); $addr = new Address();
$country = (new Country()) $country = (new Country())

View File

@ -41,7 +41,7 @@ class AccompanyingPeriodStepChangeCronjobTest extends TestCase
$this->assertEquals($canRun, $cronJob->canRun($cronJobExecution)); $this->assertEquals($canRun, $cronJob->canRun($cronJobExecution));
} }
public function provideRunTimes(): iterable public static function provideRunTimes(): iterable
{ {
// can run, during the night // can run, during the night
yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-14T00:00:00+02:00'), true]; yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-14T00:00:00+02:00'), true];

View File

@ -120,7 +120,7 @@ class ConflictTest extends WebTestCase
self::assertResponseStatusCodeSame(409); self::assertResponseStatusCodeSame(409);
} }
public function generateAccompanyingPeriodWork(): iterable public static function generateAccompanyingPeriodWork(): iterable
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -48,7 +48,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function dataGenerateNewAccompanyingCourse() public static function dataGenerateNewAccompanyingCourse()
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);
@ -85,7 +85,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function dataGenerateRandomAccompanyingCourse() public static function dataGenerateRandomAccompanyingCourse()
{ {
// note about max result for person query, and maxGenerated: // note about max result for person query, and maxGenerated:
// //
@ -152,7 +152,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function dataGenerateRandomAccompanyingCourseWithSocialIssue() public static function dataGenerateRandomAccompanyingCourseWithSocialIssue()
{ {
// note about max result for person query, and maxGenerated: // note about max result for person query, and maxGenerated:
// //
@ -224,7 +224,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function dataGenerateRandomRequestorValidData(): \Iterator public static function dataGenerateRandomRequestorValidData(): \Iterator
{ {
$dataLength = 2; $dataLength = 2;
$maxResults = 100; $maxResults = 100;

View File

@ -41,7 +41,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function dataGenerateRandomUsers(): \Iterator public static function dataGenerateRandomUsers(): \Iterator
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -92,7 +92,7 @@ final class HouseholdApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function generateHouseholdId() public static function generateHouseholdId()
{ {
self::bootKernel(); self::bootKernel();
@ -124,7 +124,7 @@ final class HouseholdApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function generatePersonId() public static function generatePersonId()
{ {
self::bootKernel(); self::bootKernel();

View File

@ -39,7 +39,7 @@ final class HouseholdControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function generateValidHouseholdIds() public static function generateValidHouseholdIds()
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -30,7 +30,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
public function provideValidDataEditMember(): \Iterator public static function provideValidDataEditMember(): \Iterator
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);
@ -48,7 +48,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
yield [\array_pop($membershipIds)['id']]; yield [\array_pop($membershipIds)['id']];
} }
public function provideValidDataMove(): \Iterator public static function provideValidDataMove(): \Iterator
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -26,7 +26,7 @@ final class PersonApiControllerTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
public function dataGetPersonFromCenterA(): \Iterator public static function dataGetPersonFromCenterA(): \Iterator
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);
@ -49,7 +49,7 @@ final class PersonApiControllerTest extends WebTestCase
yield \array_pop($personIds); yield \array_pop($personIds);
} }
public function dataGetPersonFromCenterB(): \Iterator public static function dataGetPersonFromCenterB(): \Iterator
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -188,7 +188,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
* *
* @return mixed[] * @return mixed[]
*/ */
public function validTextFieldsProvider() public static function validTextFieldsProvider()
{ {
return [ return [
['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()], ['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],

View File

@ -23,7 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/ */
final class PersonDuplicateControllerViewTest extends WebTestCase final class PersonDuplicateControllerViewTest extends WebTestCase
{ {
public function providePersonData(): iterable public static function providePersonData(): iterable
{ {
self::bootKernel(); self::bootKernel();

View File

@ -40,7 +40,7 @@ final class RelationshipApiControllerTest extends WebTestCase
self::ensureKernelShutdown(); self::ensureKernelShutdown();
} }
public function personProvider(): array public static function personProvider(): array
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/ */
final class PersonCreateEventTest extends TestCase final class PersonCreateEventTest extends TestCase
{ {
public function generateAltNames(): iterator public static function generateAltNames(): iterator
{ {
yield ['vinCENT', 'VINCENT']; yield ['vinCENT', 'VINCENT'];
@ -32,7 +32,7 @@ final class PersonCreateEventTest extends TestCase
yield ['émile', 'ÉMILE']; yield ['émile', 'ÉMILE'];
} }
public function generateNames(): iterator public static function generateNames(): iterator
{ {
yield ['émelie-marie', 'Émelie-Marie', 'lenaerts', 'LENAERTS']; yield ['émelie-marie', 'Émelie-Marie', 'lenaerts', 'LENAERTS'];

View File

@ -38,7 +38,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest
return $this->filter; return $this->filter;
} }
public function getFormData(): array public static function getFormData(): array
{ {
return [ return [
[ [
@ -47,7 +47,7 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest
]; ];
} }
public function getQueryBuilders(): array public static function getQueryBuilders(): array
{ {
self::bootKernel(); self::bootKernel();

View File

@ -90,10 +90,11 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
self::assertIsArray($result); self::assertIsArray($result);
} }
public function dataProviderTestAddFilterAccompanyingPeriod(): iterable public static function dataProviderTestAddFilterAccompanyingPeriod(): iterable
{ {
self::setUp(); self::bootKernel();
$qb = $this->entityManager->createQueryBuilder(); $entityManager = self::getContainer()->get(EntityManagerInterface::class);
$qb = $entityManager->createQueryBuilder();
$qb $qb
->select('acp.id') ->select('acp.id')

View File

@ -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'); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('no user found'); throw new \RuntimeException('no user found');
} }
$persons = $this->entityManager $persons = $entityManager
->createQuery('SELECT p FROM '.Person::class.' p JOIN p.centerCurrent current_center') ->createQuery('SELECT p FROM '.Person::class.' p JOIN p.centerCurrent current_center')
->setMaxResults(4) ->setMaxResults(4)
->getResult(); ->getResult();
@ -165,7 +168,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
/** @var Person $person */ /** @var Person $person */
[$person, $anotherPerson, $person2, $person3] = $persons; [$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll(); $scopes = $scopeRepository->findAll();
if (3 > count($scopes)) { if (3 > count($scopes)) {
throw new \RuntimeException('not enough scopes for this test'); throw new \RuntimeException('not enough scopes for this test');
@ -173,14 +176,14 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
$scopesCanSee = [$scopes[0]]; $scopesCanSee = [$scopes[0]];
$scopesGroup2 = [$scopes[1]]; $scopesGroup2 = [$scopes[1]];
$centers = $this->centerRepository->findActive(); $centers = $centerRepository->findActive();
$aCenterNotAssociatedToPerson = array_values(array_filter($centers, fn (Center $c) => $c !== $person->getCenter()))[0]; $aCenterNotAssociatedToPerson = array_values(array_filter($centers, fn (Center $c) => $c !== $person->getCenter()))[0];
if (2 > count($centers)) { if (2 > count($centers)) {
throw new \RuntimeException('not enough centers for this test'); 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); $period->setUser($user);
yield [ 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 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->setUser($user);
$period->setConfidential(true); $period->setConfidential(true);
@ -267,7 +270,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
'period confidential be visible if user has required scopes', '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'); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('no user found'); throw new \RuntimeException('no user found');
} }
/** @var Person $person */ /** @var Person $person */
$persons = $this->entityManager $persons = $entityManager
->createQuery('SELECT p FROM '.Person::class.' p ') ->createQuery('SELECT p FROM '.Person::class.' p ')
->setMaxResults(4) ->setMaxResults(4)
->getResult(); ->getResult();
@ -339,7 +345,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
[$person, $anotherPerson, $person2, $person3] = $persons; [$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll(); $scopes = $scopeRepository->findAll();
if (3 > count($scopes)) { if (3 > count($scopes)) {
throw new \RuntimeException('not enough scopes for this test'); throw new \RuntimeException('not enough scopes for this test');
@ -347,13 +353,13 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
$scopesCanSee = [$scopes[0]]; $scopesCanSee = [$scopes[0]];
$scopesGroup2 = [$scopes[1]]; $scopesGroup2 = [$scopes[1]];
$centers = $this->centerRepository->findActive(); $centers = $centerRepository->findActive();
if (2 > count($centers)) { if (2 > count($centers)) {
throw new \RuntimeException('not enough centers for this test'); 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 // expected scope: can see the period
yield [ yield [
@ -405,7 +411,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
'period should not be visible for user having right in another scope (with multiple centers)', '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'); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('no user found'); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('Center A not found'); 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'))) ->setBirthdate((new \DateTime('today'))->sub(new \DateInterval('P'.random_int(18, 100).'Y')))
->setCenter($centerA) ->setCenter($centerA)
; ;
$this->entityManager->persist($p); $entityManager->persist($p);
self::$entitiesToDelete[] = [Person::class, $p->getId()]; self::$entitiesToDelete[] = [Person::class, $p->getId()];
} }
[$person, $anotherPerson, $person2, $person3] = $persons; [$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll(); $scopes = $scopeRepository->findAll();
if (3 > count($scopes)) { if (3 > count($scopes)) {
throw new \RuntimeException('not enough scopes for this test'); throw new \RuntimeException('not enough scopes for this test');
@ -488,7 +496,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
$scopesGroup2 = [$scopes[1]]; $scopesGroup2 = [$scopes[1]];
// case: a period is in draft state // 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']; 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']; yield [$anotherUser, $person, $scopesCanSee, [], [], 'another user is not allowed to see the period of someone else in draft state'];
// the period is confirmed // 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 // the other user can now see it
yield [$user, $anotherPerson, $scopesCanSee, [], [$period], 'a user see his period when confirmed']; 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']; 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 // 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); $period->setConfidential(true)->setUser($user, true);
yield [$user, $person2, $scopesCanSee, [], [$period], 'a user see his period when confirmed and confidential with required scopes']; 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']; 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 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']; 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 * @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 = new AccompanyingPeriod();
$period->addPerson($person); $period->addPerson($person);
if (null !== $creator) { if (null !== $creator) {
@ -533,11 +544,11 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
$period->addScope($scope); $period->addScope($scope);
} }
$this->entityManager->persist($period); $entityManager->persist($period);
self::$periodsIdsToDelete[] = $period->getId(); self::$periodsIdsToDelete[] = $period->getId();
if ($confirm) { if ($confirm) {
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle'); $workflow = $registry->get($period, 'accompanying_period_lifecycle');
$workflow->apply($period, 'confirm'); $workflow->apply($period, 'confirm');
} }

View File

@ -77,7 +77,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
$this->normalizer = self::getContainer()->get(NormalizerInterface::class); $this->normalizer = self::getContainer()->get(NormalizerInterface::class);
} }
public function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable public static function dataGeneratorNormalizationNullOrNotNullHaveSameKeys(): iterable
{ {
yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read']]]; 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]]; yield [['docgen:expects' => Person::class, 'groups' => ['docgen:read'], 'docgen:person:with-budget' => true]];
} }
public function generateData() public static function generateData()
{ {
$person = new Person(); $person = new Person();
$person $person

View File

@ -124,7 +124,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
call_user_func($assertionsOnData, $data); call_user_func($assertionsOnData, $data);
} }
public function provideNormalizedData(): iterable public static function provideNormalizedData(): iterable
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -115,7 +115,7 @@ final class PersonContextTest extends KernelTestCase
call_user_func($assertionsOnData, $data); call_user_func($assertionsOnData, $data);
} }
public function provideNormalizedData(): iterable public static function provideNormalizedData(): iterable
{ {
self::bootKernel(); self::bootKernel();
$em = self::getContainer()->get(EntityManagerInterface::class); $em = self::getContainer()->get(EntityManagerInterface::class);

View File

@ -99,11 +99,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase
self::assertStringContainsStringIgnoringCase('TRUE = FALSE', $sql); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('There is no person'); throw new \RuntimeException('There is no person');
} }
@ -116,11 +117,12 @@ class AccompanyingPeriodCalendarGenericDocProviderTest extends KernelTestCase
yield [$person, null, new \DateTimeImmutable('6 month ago'), null]; 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('There is no accompanying period'); throw new \RuntimeException('There is no accompanying period');
} }

View File

@ -70,7 +70,7 @@ class AccompanyingPeriodWorkEvaluationGenericDocProviderTest extends KernelTestC
self::assertIsInt($nb, 'Test that there are no errors'); self::assertIsInt($nb, 'Test that there are no errors');
} }
public function provideSearchArguments(): iterable public static function provideSearchArguments(): iterable
{ {
yield [null, null, null]; yield [null, null, null];
yield [new \DateTimeImmutable('1 month ago'), null, null]; yield [new \DateTimeImmutable('1 month ago'), null, null];

View File

@ -52,11 +52,12 @@ class PersonCalendarGenericDocProviderTest extends KernelTestCase
self::assertIsInt($nb); 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()) { ->setMaxResults(1)->getSingleResult()) {
throw new \RuntimeException('There is no person'); throw new \RuntimeException('There is no person');
} }

View File

@ -50,7 +50,7 @@ class ClosingMotiveRenderTest extends KernelTestCase
self::assertStringContainsString($expectedContent, $actual); self::assertStringContainsString($expectedContent, $actual);
} }
public function provideClosingMotiveWithRenderString(): iterable public static function provideClosingMotiveWithRenderString(): iterable
{ {
$closingMotive = (new ClosingMotive())->setName(['fr' => 'Left']); $closingMotive = (new ClosingMotive())->setName(['fr' => 'Left']);

View File

@ -28,7 +28,7 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
public function provideDataPersonWithAccompanyingPeriod() public static function provideDataPersonWithAccompanyingPeriod()
{ {
self::bootKernel(); self::bootKernel();

View File

@ -25,7 +25,7 @@ use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
*/ */
final class MaxHolderValidatorTest extends ConstraintValidatorTestCase final class MaxHolderValidatorTest extends ConstraintValidatorTestCase
{ {
public function provideInvalidHousehold() public static function provideInvalidHousehold()
{ {
$household = new Household(); $household = new Household();
$position = (new Position()) $position = (new Position())