upgrade phpunit: make data provider static

This commit is contained in:
2024-02-14 12:28:14 +01:00
parent d5115b3718
commit f251e6f100
57 changed files with 142 additions and 121 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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');
}

View File

@@ -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];

View File

@@ -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');
}