protected function getExtensions()
 {
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $emailAddressRecipients = new EmailAddressRecipientsType($configManager);
     $select2Hidden = new Select2Type('hidden');
     return [new PreloadedExtension([$emailAddressRecipients->getName() => $emailAddressRecipients, $select2Hidden->getName() => $select2Hidden], [])];
 }
Example #2
0
 protected function getExtensions()
 {
     $emailAddressType = new EmailAddressType($this->securityContext);
     $translatableType = $this->getMockBuilder('Oro\\Bundle\\TranslationBundle\\Form\\Type\\TranslatableEntityType')->disableOriginalConstructor()->getMock();
     $translatableType->expects($this->any())->method('getName')->will($this->returnValue(TranslatableEntityType::NAME));
     $select2ChoiceType = new Select2Type(TranslatableEntityType::NAME);
     $emailTemplateList = new EmailTemplateSelectType();
     return array(new PreloadedExtension([TranslatableEntityType::NAME => $translatableType, $select2ChoiceType->getName() => $select2ChoiceType, $emailTemplateList->getName() => $emailTemplateList, $emailAddressType->getName() => $emailAddressType], []));
 }
Example #3
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();
 }
Example #4
0
 protected function getExtensions()
 {
     $emailAddressType = new EmailAddressType($this->securityContext);
     $translatableType = $this->getMockBuilder('Oro\\Bundle\\TranslationBundle\\Form\\Type\\TranslatableEntityType')->disableOriginalConstructor()->getMock();
     $translatableType->expects($this->any())->method('getName')->will($this->returnValue(TranslatableEntityType::NAME));
     $select2ChoiceType = new Select2Type(TranslatableEntityType::NAME);
     $emailTemplateList = new EmailTemplateSelectType();
     $attachmentsType = new EmailAttachmentsType();
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $htmlTagProvider = $this->getMock('Oro\\Bundle\\FormBundle\\Provider\\HtmlTagProvider');
     $htmlTagProvider->expects($this->any())->method('getAllowedElements')->willReturn(['br', 'a']);
     $richTextType = new OroRichTextType($configManager, $htmlTagProvider);
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $metadata = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadataInfo')->disableOriginalConstructor()->getMock();
     $metadata->expects($this->any())->method('getName');
     $em->expects($this->any())->method('getClassMetadata')->willReturn($metadata);
     $repo = $this->getMockBuilder('\\Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $repo->expects($this->any())->method('find');
     $em->expects($this->any())->method('getRepository')->willReturn($repo);
     $contextsSelectType = new ContextsSelectType($em);
     return [new PreloadedExtension([TranslatableEntityType::NAME => $translatableType, $select2ChoiceType->getName() => $select2ChoiceType, $emailTemplateList->getName() => $emailTemplateList, $emailAddressType->getName() => $emailAddressType, $richTextType->getName() => $richTextType, $attachmentsType->getName() => $attachmentsType, ContextsSelectType::NAME => $contextsSelectType, 'genemu_jqueryselect2_hidden' => new Select2Type('hidden')], [])];
 }
Example #5
0
 protected function getExtensions()
 {
     $emailAddressType = new EmailAddressType($this->securityContext);
     $translatableType = $this->getMockBuilder('Oro\\Bundle\\TranslationBundle\\Form\\Type\\TranslatableEntityType')->disableOriginalConstructor()->getMock();
     $translatableType->expects($this->any())->method('getName')->will($this->returnValue(TranslatableEntityType::NAME));
     $user = new User();
     $securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $securityFacade->expects($this->any())->method('getLoggedUser')->will($this->returnValue($user));
     $relatedEmailsProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\RelatedEmailsProvider')->disableOriginalConstructor()->getMock();
     $relatedEmailsProvider->expects($this->any())->method('getEmails')->with($user)->will($this->returnValue(['*****@*****.**' => 'John Smith <*****@*****.**>']));
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $select2ChoiceType = new Select2Type(TranslatableEntityType::NAME);
     $genemuChoiceType = new Select2Type('choice');
     $emailTemplateList = new EmailTemplateSelectType();
     $attachmentsType = new EmailAttachmentsType();
     $emailAddressFromType = new EmailAddressFromType($securityFacade, $relatedEmailsProvider);
     $emailAddressRecipientsType = new EmailAddressRecipientsType($configManager);
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $htmlTagProvider = $this->getMock('Oro\\Bundle\\FormBundle\\Provider\\HtmlTagProvider');
     $htmlTagProvider->expects($this->any())->method('getAllowedElements')->willReturn(['br', 'a']);
     $richTextType = new OroRichTextType($configManager, $htmlTagProvider);
     $resizableRichTextType = new OroResizeableRichTextType($configManager, $htmlTagProvider);
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $metadata = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadataInfo')->disableOriginalConstructor()->getMock();
     $metadata->expects($this->any())->method('getName');
     $em->expects($this->any())->method('getClassMetadata')->willReturn($metadata);
     $repo = $this->getMockBuilder('\\Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $repo->expects($this->any())->method('find');
     $em->expects($this->any())->method('getRepository')->willReturn($repo);
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $translator = $this->getMockBuilder('Symfony\\Component\\Translation\\DataCollectorTranslator')->disableOriginalConstructor()->getMock();
     $mapper = $this->getMockBuilder('Oro\\Bundle\\SearchBundle\\Engine\\ObjectMapper')->disableOriginalConstructor()->getMock();
     $securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock();
     $contextsSelectType = new ContextsSelectType($em, $configManager, $translator, $mapper, $securityFacade);
     return [new PreloadedExtension([TranslatableEntityType::NAME => $translatableType, $select2ChoiceType->getName() => $select2ChoiceType, $emailTemplateList->getName() => $emailTemplateList, $emailAddressType->getName() => $emailAddressType, $richTextType->getName() => $richTextType, $resizableRichTextType->getName() => $resizableRichTextType, $attachmentsType->getName() => $attachmentsType, ContextsSelectType::NAME => $contextsSelectType, 'genemu_jqueryselect2_hidden' => new Select2Type('hidden'), $genemuChoiceType->getName() => $genemuChoiceType, $emailAddressFromType->getName() => $emailAddressFromType, $emailAddressRecipientsType->getName() => $emailAddressRecipientsType], [])];
 }
Example #6
0
 protected function getExtensions()
 {
     $validator = new Validator(new ClassMetadataFactory(new LoaderChain([])), new ConstraintValidatorFactory(), new DefaultTranslator());
     $select2ChoiceType = new Select2Type('choice');
     return [new PreloadedExtension([$select2ChoiceType->getName() => $select2ChoiceType], ['form' => [new DataBlockExtension(), new FormTypeValidatorExtension($validator)], 'choice' => [new TranslatableChoiceTypeExtension()]])];
 }
 protected function getExtensions()
 {
     $select2Choice = new Select2Type('choice');
     return [new PreloadedExtension([$select2Choice->getName() => $select2Choice], [])];
 }