namespace ; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\Tools\SchemaTool; use App\Entity\; use ; use ; /** * @covers \App\Entity\ */ class extends KernelTestCase { /** * @var Doctrine\ORM\EntityManager */ protected $entityManager; public function setUp(): void { // Boot the AppKernel in the test environment and with the debug. self::bootKernel(); // Store the container and the entity manager in test case properties $this->entityManager = static::$kernel->getContainer()->get('doctrine.orm.entity_manager'); parent::setUp(); } /** */ public function testCreate() {$deps){ $variablename=explode('\\',$class)?> $= new \(); $->add(); $->set(); $this->entityManager->persist($); $class= new (); $class->add($); $class->set(); $this->entityManager->persist($class); $this->entityManager->flush(); $this->assertIsInt($class->getId()); return $class->getId(); } /** * @depends testCreate */ public function testRead($id) { $class=$this->entityManager->getRepository('App:') ->findOneById($id); $this->assertIsObject($class); return $class; } /** * @depends testRead */ public function testUpdate($class) { $class->add(); $class->set(); $this->entityManager->persist($class); $this->entityManager->flush(); $this->assertIsInt($class->getId()); return $class->getId(); } /** * @depends testUpdate */ public function testDelete($id) { $class = $this->entityManager->getReference('App:', $id); // Remove it and flush $this->entityManager->remove($class); $this->entityManager->flush(); $class= $this->getRepository('App:')->findOneById($id); $this->assetTrue(empty($class)); } }