Fix kernel booting problem on Aggregator and Filter tests

This commit is contained in:
Julien Fastré 2023-09-01 10:54:32 +02:00
parent d8062be131
commit 355ed03500
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 16 additions and 10 deletions

View File

@ -50,8 +50,9 @@ final class AgentFilterTest extends AbstractFilterTest
return $this->filter; return $this->filter;
} }
public function getFormData(): array public function getFormData(): iterable
{ {
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class); $em = self::$container->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder() $array = $em->createQueryBuilder()
@ -63,26 +64,26 @@ final class AgentFilterTest extends AbstractFilterTest
$data = []; $data = [];
foreach ($array as $a) { foreach ($array as $a) {
$data[] = [ yield [
'accepted_agents' => $a, 'accepted_agents' => $a,
]; ];
} }
return $data; self::ensureKernelShutdown();
} }
public function getQueryBuilders(): array public function getQueryBuilders(): iterable
{ {
if (null === self::$kernel) {
self::bootKernel(); self::bootKernel();
}
$em = self::$container->get(EntityManagerInterface::class); $em = self::$container->get(EntityManagerInterface::class);
return [ yield
$em->createQueryBuilder() $em->createQueryBuilder()
->select('cal.id') ->select('cal.id')
->from(Calendar::class, 'cal'), ->from(Calendar::class, 'cal')
]; ;
self::ensureKernelShutdown();
} }
} }

View File

@ -40,6 +40,11 @@ abstract class AbstractFilterTest extends KernelTestCase
$this->prophet = $this->getProphet(); $this->prophet = $this->getProphet();
} }
protected function tearDown(): void
{
self::ensureKernelShutdown();
}
/** /**
* provide data for `testAliasDidNotDisappears`. * provide data for `testAliasDidNotDisappears`.
*/ */