/** * @covers TheSportsDb\Entity\EntityManager::repository */ public function testRepository() { $this->expectException(\Exception::class); $this->expectExceptionMessage('No repository container set.'); $this->entityManager->repository('testEntityType'); $repositoryContainer = $this->getMockBuilder(RepositoryContainerInterface::class)->getMock(); $repositoryContainer->expects($this->once())->method('getRepository')->with('testEntityType')->willReturn('testRepository'); $this->entityManager->setRepositoryContainer($repositoryContainer); $this->assertEquals('testRepository', $this->entityManager->repository('testEntityType')); }