diff --git a/application/tests/Unit/Repository/UserRepositoryTest.php b/application/tests/Unit/Repository/UserRepositoryTest.php new file mode 100644 index 0000000..b34f751 --- /dev/null +++ b/application/tests/Unit/Repository/UserRepositoryTest.php @@ -0,0 +1,55 @@ +entityManager = $kernel->getContainer()->get('doctrine')->getManager(); + $this->userRepository = $this->entityManager->getRepository(User::class); + } + + public function testCreation(): void + { + $user = new User(); + $user->setId(self::USER_ID); + $this->entityManager->persist($user); + $this->entityManager->flush(); + /** + * @var UserInterface + */ + $loadedUser = $this->userRepository->find(self::USER_ID); + $this->assertEquals(self::USER_ID, $loadedUser->getId()); + } + + /** + * {@inheritdoc} + * + * @see \Symfony\Bundle\FrameworkBundle\Test\KernelTestCase::tearDown() + */ + protected function tearDown(): void + { + parent::tearDown(); + $this->entityManager->close(); + $this->entityManager = null; + } +}