/** * @covers TheSportsDb\Entity\EntityManager::factory */ public function testFactory() { $this->expectException(\Exception::class); $this->expectExceptionMessage('No factory container set.'); $this->entityManager->factory('testEntityType'); $repositoryContainer = $this->getMockBuilder(FactoryContainerInterface::class)->getMock(); $factoryContainer->expects($this->once())->method('getFactory')->with('testEntityType')->willReturn('testFactory'); $this->entityManager->setFactoryContainer($factoryContainer); $this->assertEquals('testFactory', $this->entityManager->factory('testEntityType')); }