factory = new Action\HealthActionFactory(); } /** @test */ public function serviceIsCreatedExtractingConnectionFromEntityManager() { $em = $this->prophesize(EntityManager::class); $conn = $this->prophesize(Connection::class); $getConnection = $em->getConnection()->willReturn($conn->reveal()); $sm = new ServiceManager(['services' => [ 'Logger_Shlink' => $this->prophesize(LoggerInterface::class)->reveal(), AppOptions::class => $this->prophesize(AppOptions::class)->reveal(), EntityManager::class => $em->reveal(), ]]); $instance = ($this->factory)($sm, ''); $this->assertInstanceOf(Action\HealthAction::class, $instance); $getConnection->shouldHaveBeenCalledOnce(); } }