DX: fix test on AccompanyingCourseExportHelperTest.php

This commit is contained in:
Julien Fastré 2023-10-16 17:52:25 +02:00
parent be8975ee04
commit b32fa42afa
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -33,13 +33,10 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
private EntityManagerInterface $em; private EntityManagerInterface $em;
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
protected function setUp(): void protected function setUp(): void
{ {
self::bootKernel(); self::bootKernel();
$this->em = self::$container->get(EntityManagerInterface::class); $this->em = self::$container->get(EntityManagerInterface::class);
$this->accompanyingCourseExportHelper = self::$container->get(AccompanyingCourseExportHelper::class);
} }
public static function tearDownAfterClass(): void public static function tearDownAfterClass(): void
@ -63,7 +60,7 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
[$periodA, $periodB, $periodC] = $this->prepareData(); [$periodA, $periodB, $periodC] = $this->prepareData();
$qb = $this->em->getRepository(AccompanyingPeriod::class)->createQueryBuilder('acp'); $qb = $this->em->getRepository(AccompanyingPeriod::class)->createQueryBuilder('acp');
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
$qb->select('acp.id'); $qb->select('acp.id');
@ -105,13 +102,12 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
$this->em->persist($periodB); $this->em->persist($periodB);
$this->em->persist($periodC); $this->em->persist($periodC);
self::$entitiesToDelete[] = [ClosingMotive::class, $cmChild];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmA];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmB];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodA]; self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodA];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodB]; self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodB];
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodC]; self::$entitiesToDelete[] = [AccompanyingPeriod::class, $periodC];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmChild];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmA];
self::$entitiesToDelete[] = [ClosingMotive::class, $cmB];
$this->em->flush(); $this->em->flush();
$this->em->clear(); $this->em->clear();