示例#1
0
 public function testLoadClassMetadataWithoutParent()
 {
     $this->loadClassMetadataEvent->getClassMetadata()->willReturn($this->classMetadata->reveal());
     $this->classMetadata->getName()->willReturn(get_class($this->object->reveal()));
     $this->classMetadata->setCustomRepositoryClass('Sulu\\Bundle\\ContactBundle\\Entity\\ContactRepository')->shouldNotBeCalled();
     $this->loadClassMetadataEvent->getEntityManager()->willReturn($this->entityManager->reveal());
     $this->entityManager->getConfiguration()->willReturn($this->configuration->reveal());
     $this->configuration->getNamingStrategy()->willReturn(null);
     /** @var \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver $mappingDriver */
     $mappingDriver = $this->prophesize('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriver');
     $this->configuration->getMetadataDriverImpl()->willReturn($mappingDriver->reveal());
     $mappingDriver->getAllClassNames()->willReturn([get_class($this->parentObject->reveal())]);
     $mappingDriver->loadMetadataForClass(get_class($this->parentObject->reveal()), Argument::type('Doctrine\\ORM\\Mapping\\ClassMetadata'))->shouldBeCalled();
     $this->subscriber->loadClassMetadata($this->loadClassMetadataEvent->reveal());
 }