/**
  * Test that a entity manager can be created.
  */
 public function testEntityManagerCreation()
 {
     $config = $this->createMock(Config::class);
     $cache = $this->createMock(Cache::class);
     $mappingDriver = $this->createMock(MappingDriver::class);
     $provider = new EntityManagerProvider($config, $cache, $mappingDriver);
     $this->assertInstanceOf(EntityManagerInterface::class, $provider->getEntityManager());
 }
Exemplo n.º 2
0
 /**
  * Get entity manager.
  *
  * @return EntityManagerInterface
  *
  * @throws \LogicException
  */
 public function getEntityManager()
 {
     if (!$this->initialized) {
         throw new \LogicException('The entity manager is not available before initialization');
     }
     if (null === $this->entityManager) {
         $provider = new EntityManagerProvider($this->config, $this->getCache(), $this->getMappingDriver());
         $this->entityManager = $provider->getEntityManager();
     }
     return $this->entityManager;
 }