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], [])];
 }
예제 #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));
     $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], [])];
 }