diff --git a/application/symfony/tests/Unit/Repository/RightRepositoryTest.php b/application/symfony/tests/Unit/Repository/Meta/RightRepositoryTest.php similarity index 98% rename from application/symfony/tests/Unit/Repository/RightRepositoryTest.php rename to application/symfony/tests/Unit/Repository/Meta/RightRepositoryTest.php index dc9ac26..48abdf9 100644 --- a/application/symfony/tests/Unit/Repository/RightRepositoryTest.php +++ b/application/symfony/tests/Unit/Repository/Meta/RightRepositoryTest.php @@ -1,6 +1,6 @@ getContainer() + ->get('doctrine') + ->getManager(); + $this->sourceRepository = $entityManager->getRepository(AbstractSource::class); + } + + public function testLoadBySlugOrId(): void + { + $requestedSource = $this->createMock(RequestedSourceInterface::class); + $requestedSource->method('hasSlug')->willReturn(true); + $requestedSource->method('getSlug')->willReturn(SystemSlugType::IMPRINT); + $imprint = $this->sourceRepository->findOneByIdOrSlug($requestedSource); + $this->assertInstanceOf(SourceInterface::class, $imprint); + $requestedSource2 = $this->createMock(RequestedSourceInterface::class); + $requestedSource2->method('hasId')->willReturn(true); + $requestedSource2->method('getId')->willReturn($imprint->getId()); + $imprint2 = $this->sourceRepository->findOneByIdOrSlug($requestedSource2); + $this->assertInstanceOf(SourceInterface::class, $imprint2); + } + + public function testLoadBySlug(): void + { + $imprint = $this->sourceRepository->findOneBySlug(SystemSlugType::IMPRINT); + $this->assertInstanceOf(SourceInterface::class, $imprint); + } +} diff --git a/application/symfony/tests/Unit/Repository/UserSourceRepositoryTest.php b/application/symfony/tests/Unit/Repository/Source/UserSourceRepositoryTest.php similarity index 98% rename from application/symfony/tests/Unit/Repository/UserSourceRepositoryTest.php rename to application/symfony/tests/Unit/Repository/Source/UserSourceRepositoryTest.php index abbbe0a..476cd3d 100644 --- a/application/symfony/tests/Unit/Repository/UserSourceRepositoryTest.php +++ b/application/symfony/tests/Unit/Repository/Source/UserSourceRepositoryTest.php @@ -1,6 +1,6 @@