protected function setUp()
 {
     $metadataDriver = new AnnotationDriver(new AnnotationReader(), __DIR__ . '/../Fixtures/Entity');
     $this->em = $this->getTestEntityManager();
     $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver);
     $this->em->getConfiguration()->setEntityNamespaces(['Test' => 'Oro\\Bundle\\FormBundle\\Tests\\Unit\\Fixtures\\Entity']);
 }
Ejemplo n.º 2
0
 protected function setUp()
 {
     $reader = new AnnotationReader();
     $metadataDriver = new AnnotationDriver($reader, 'Oro\\Bundle\\ApiBundle\\Tests\\Unit\\Fixtures\\Entity');
     $this->em = $this->getTestEntityManager();
     $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver);
     $this->em->getConfiguration()->setEntityNamespaces(['Test' => 'Oro\\Bundle\\ApiBundle\\Tests\\Unit\\Fixtures\\Entity']);
     $doctrine = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $doctrine->expects($this->any())->method('getManagerForClass')->willReturn($this->em);
     $doctrine->expects($this->any())->method('getAliasNamespace')->will($this->returnValueMap([['Test', 'Oro\\Bundle\\ApiBundle\\Tests\\Unit\\Fixtures\\Entity']]));
     $this->doctrineHelper = new DoctrineHelper($doctrine);
 }
Ejemplo n.º 3
0
 protected function setUp()
 {
     $reader = new AnnotationReader();
     $metadataDriver = new AnnotationDriver($reader, 'Oro\\Component\\EntitySerializer\\Tests\\Unit\\Fixtures\\Entity');
     $this->em = $this->getTestEntityManager();
     $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver);
     $this->em->getConfiguration()->setEntityNamespaces(['Test' => 'Oro\\Component\\EntitySerializer\\Tests\\Unit\\Fixtures\\Entity']);
     $doctrine = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $doctrine->expects($this->any())->method('getManagerForClass')->will($this->returnValue($this->em));
     $doctrine->expects($this->any())->method('getAliasNamespace')->will($this->returnValueMap([['Test', 'Oro\\Component\\EntitySerializer\\Tests\\Unit\\Fixtures\\Entity']]));
     $this->entityFieldFilter = $this->getMock('Oro\\Component\\EntitySerializer\\EntityFieldFilterInterface');
     $this->entityFieldFilter->expects($this->any())->method('isApplicableField')->willReturn(true);
     $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $queryHintResolver = $this->getMock('Oro\\Component\\DoctrineUtils\\ORM\\QueryHintResolverInterface');
     $this->serializer = new EntitySerializer($doctrine, $this->entityFieldFilter, new EntityDataAccessor(), new EntityDataTransformer($this->container), $queryHintResolver);
 }
Ejemplo n.º 4
0
 /**
  * Changes a connection object for the given entity manager
  *
  * @param Connection        $connection
  * @param EntityManagerMock $em
  */
 protected function setDriverConnection(Connection $connection, EntityManagerMock $em)
 {
     /** @var DriverMock $driver */
     $driver = $em->getConnection()->getDriver();
     $driver->setDriverConnection($connection);
 }