$id * @return object */ protected function get(string $id): object { return $this->getContainer()->get($id); } protected function setUp(): void { $em = $this->getContainer()->get(EntityManagerInterface::class); $metadata = $em->getMetadataFactory()->getAllMetadata(); if (empty($metadata)) { throw new Exception('No metadata found. Did you forget to map entities?'); } $schemaTool = new SchemaTool($em); $schemaTool->dropDatabase(); // Clean slate, in case anything exists $schemaTool->createSchema($metadata); parent::setUp(); } #[Override] protected function tearDown(): void { $em = $this->getContainer()->get(EntityManagerInterface::class); $metadata = $em->getMetadataFactory()->getAllMetadata(); if (empty($metadata)) { throw new Exception('No metadata found. Did you forget to map entities?'); } $schemaTool = new SchemaTool($em); $schemaTool->dropDatabase(); // Clean slate, in case anything exists parent::tearDown(); } }