37 lines
967 B
PHP
37 lines
967 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Tests\Repository;
|
||
|
|
|
||
|
|
use App\Entity\Mail;
|
||
|
|
use App\Repository\MailRepository;
|
||
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||
|
|
use Doctrine\ORM\EntityManagerInterface;
|
||
|
|
|
||
|
|
class MailRepositoryTest extends KernelTestCase
|
||
|
|
{
|
||
|
|
private ?EntityManagerInterface $entityManager;
|
||
|
|
private ?MailRepository $mailRepository;
|
||
|
|
|
||
|
|
protected function setUp(): void
|
||
|
|
{
|
||
|
|
self::bootKernel();
|
||
|
|
$this->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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|