mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Work on test, but still fails
This commit is contained in:
parent
260a173a61
commit
29983cc2ad
@ -20,16 +20,13 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
|
|||||||
|
|
||||||
private EntityManagerInterface $em;
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
private EntityRepository $repository;
|
|
||||||
|
|
||||||
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
|
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->repository = self::$container->get($this->em->getRepository(AccompanyingPeriod::class));
|
$this->accompanyingCourseExportHelper = self::$container->get(AccompanyingCourseExportHelper::class);
|
||||||
$this->accompanyingPeriodExportHelper = self::$container->get(AccompanyingCourseExportHelper::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function tearDownAfterClass(): void
|
public static function tearDownAfterClass(): void
|
||||||
@ -57,14 +54,19 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
|
|||||||
AccompanyingPeriod $periodC // canceled (child cm of canceled cm)
|
AccompanyingPeriod $periodC // canceled (child cm of canceled cm)
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
$qb = $this->repository->createQueryBuilder('acp');
|
$qb = $this->em->getRepository(AccompanyingPeriod::class)->createQueryBuilder('acp');
|
||||||
$qb->select('acp.id')->from(AccompanyingPeriod::class, 'acp');
|
|
||||||
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
|
$qb->select('acp.id');
|
||||||
|
|
||||||
$periodIdsFound = $qb->getQuery()->getResult();
|
$periodIdsFound = $qb->getQuery()->getResult();
|
||||||
|
|
||||||
|
$periodA = $this->em->find(AccompanyingPeriod::class, $periodA->getId());
|
||||||
|
$periodB = $this->em->find(AccompanyingPeriod::class, $periodB->getId());
|
||||||
|
$periodC = $this->em->find(AccompanyingPeriod::class, $periodC->getId());
|
||||||
|
|
||||||
self::assertContains($periodB->getId(), $periodIdsFound, 'Period without canceled closing motive has been found');
|
self::assertContains($periodB->getId(), $periodIdsFound, 'Period without canceled closing motive has been found');
|
||||||
self::assertNotContains($periodA->getId(), $periodIdsFound, 'Period with canceled closing motive has not been found');
|
self::assertNotContains($periodA->getdId(), $periodIdsFound, 'Period with canceled closing motive has not been found');
|
||||||
self::assertNotContains($periodC->getId(), $periodIdsFound, 'Period with child canceled closing motive has not been found');
|
self::assertNotContains($periodC->getId(), $periodIdsFound, 'Period with child canceled closing motive has not been found');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,15 +99,15 @@ 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, $cmA];
|
||||||
self::$entitiesToDelete[] = [ClosingMotive::class, $cmB];
|
self::$entitiesToDelete[] = [ClosingMotive::class, $cmB];
|
||||||
self::$entitiesToDelete[] = [ClosingMotive::class, $cmChild];
|
|
||||||
|
|
||||||
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];
|
||||||
|
|
||||||
yield [$periodA, $periodB, $periodC];
|
yield [$periodA, $periodB, $periodC, 'Verify that period with non-canceling closing motive is found'];
|
||||||
|
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
$this->em->clear();
|
$this->em->clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user