fix tests implementing AbstractFilterTest

This commit is contained in:
2023-09-01 13:51:02 +02:00
parent f8f04c69d0
commit a197a6b418
56 changed files with 447 additions and 373 deletions

View File

@@ -63,9 +63,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -50,32 +50,24 @@ final class JobFilterTest extends AbstractFilterTest
return $this->filter;
}
public function getFormData(): array
public function getFormData(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(UserJob::class, 'uj')
->select('uj')
->getQuery()
->setMaxResults(1)
->getResult();
$data = [];
foreach ($array as $a) {
$data[] = [
'job' => $a,
];
}
return $data;
yield ['job' => $array];
}
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -83,7 +75,6 @@ final class JobFilterTest extends AbstractFilterTest
$em->createQueryBuilder()
->select('cal.id')
->from(Calendar::class, 'cal')
->join('cal.user', 'caluser'),
];
}
}

View File

@@ -52,12 +52,14 @@ final class ScopeFilterTest extends AbstractFilterTest
public function getFormData(): array
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(Scope::class, 's')
->select('s')
->getQuery()
->setMaxResults(1)
->getResult();
$data = [];
@@ -73,9 +75,7 @@ final class ScopeFilterTest extends AbstractFilterTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -83,7 +83,6 @@ final class ScopeFilterTest extends AbstractFilterTest
$em->createQueryBuilder()
->select('cal.id')
->from(Calendar::class, 'cal')
->join('cal.user', 'caluser'),
];
}
}