From 9cdef5f95114c88d9770631a4daa88271d9cfa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 22 Jul 2023 23:50:26 +0200 Subject: [PATCH] Fix: remove data after executing CronJobDatabaseInteractionTest --- .../Tests/Cron/CronJobDatabaseInteractionTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php index 0b80730fe..3dc6fd66c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Cron/CronJobDatabaseInteractionTest.php @@ -40,6 +40,17 @@ class CronJobDatabaseInteractionTest extends KernelTestCase $this->cronJobExecutionRepository = self::$container->get(CronJobExecutionRepository::class); } + public static function tearDownAfterClass(): void + { + self::bootKernel(); + + $entityManager = self::$container->get(EntityManagerInterface::class); + + $entityManager->createQuery("DELETE " . CronJobExecution::class . ' cje WHERE cje.key LIKE :key') + ->setParameter('key', 'test-with-data') + ->execute(); + } + public function testCompleteLifeCycle(): void { $cronjob = $this->prophesize(CronJobInterface::class);