getContainer() ->get('doctrine') ->getManager(); $this->sourceRepository = $entityManager->getRepository(AbstractSource::class); } public function testLoadBySlugOrId(): void { $requestedSource = $this->createMock(RequestedEntityInterface::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(RequestedEntityInterface::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); } }