예제 #1
0
 public function setUp()
 {
     $registry = $this->getMock('Symfony\\Bridge\\Doctrine\\RegistryInterface');
     $metadataDriver = new AnnotationDriver(new AnnotationReader(), 'OroCRM\\Bundle\\ChannelBundle\\Tests\\Unit\\Stubs\\Entity');
     $em = $this->getTestEntityManager();
     $config = $em->getConfiguration();
     $config->setMetadataDriverImpl($metadataDriver);
     $config->setEntityNamespaces(['OroCRMChannelBundle' => 'OroCRM\\Bundle\\ChannelBundle\\Tests\\Unit\\Stubs\\Entity']);
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     $entityType = new EntityType($registry);
     $genemuType = new Select2Type('entity');
     $this->type = new ChannelSelectType();
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions([new PreloadedExtension([$entityType->getName() => $entityType, $this->type->getName() => $this->type, $genemuType->getName() => $genemuType], [])])->getFormFactory();
 }
예제 #2
0
 protected function getExtensions()
 {
     $registry = $this->client->getContainer()->get('doctrine');
     $entityType = new EntityType($registry);
     return [new PreloadedExtension([$entityType->getName() => $entityType], [])];
 }