try to block removing a person

This commit is contained in:
Julien Fastré 2022-06-16 23:19:16 +02:00
parent 07608dc412
commit d55311ce40

View File

@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Form;
@ -48,21 +49,21 @@ final class PersonControllerCreateTest extends WebTestCase
public static function tearDownAfterClass(): void
{
self::bootKernel();
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager');
$em = self::$kernel->getContainer()->get(EntityManagerInterface::class);
//remove two people created during test
$jesus = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'God']);
if (null !== $jesus) {
$em->remove($jesus);
//$em->remove($jesus);
}
$jesus2 = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'roger']);
if (null !== $jesus2) {
$em->remove($jesus2);
//$em->remove($jesus2);
}
$em->flush();
}