entityManager = self::getContainer()->get('doctrine')->getManager(); $this->mailRepository = $this->entityManager->getRepository(Mail::class); } public function testRepositoryExistsAndIsCorrectInstance(): void { $this->assertInstanceOf(MailRepository::class, $this->mailRepository); } protected function tearDown(): void { parent::tearDown(); $this->entityManager->close(); $this->entityManager = null; // Avoid memory leaks $this->mailRepository = null; } }