/** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setUp() { $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $this->doctrineHelper = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\DoctrineHelper')->disableOriginalConstructor()->getMock(); $this->mailer = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Mailer\\DirectMailer')->disableOriginalConstructor()->getMock(); $this->mailerTransport = $this->getMockBuilder('\\Swift_Transport_EsmtpTransport')->disableOriginalConstructor()->getMock(); $this->mailer->expects($this->any())->method('getTransport')->will($this->returnValue($this->mailerTransport)); $this->emailEntityBuilder = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Builder\\EmailEntityBuilder')->disableOriginalConstructor()->getMock(); $this->emailOwnerProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Provider\\EmailOwnerProvider')->disableOriginalConstructor()->getMock(); $this->dispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->disableOriginalConstructor()->getMock(); $this->emailActivityManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Manager\\EmailActivityManager')->disableOriginalConstructor()->getMock(); $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->setMethods(['getLoggedUser', 'getOrganization'])->disableOriginalConstructor()->getMock(); $this->userEmailOrigin = $this->getMockBuilder('Oro\\Bundle\\ImapBundle\\Entity\\UserEmailOrigin')->disableOriginalConstructor()->getMock(); $this->userEmailOrigin->expects($this->any())->method('getSmtpHost')->will($this->returnValue('abc')); $this->userEmailOrigin->expects($this->any())->method('getSmtpPort')->will($this->returnValue(25)); $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->setMethods(['getService'])->disableOriginalConstructor()->getMock(); $this->securityFacadeLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityFacade)); $this->securityFacade->expects($this->any())->method('getOrganization')->will($this->returnValue($this->getTestOrganization())); $this->doctrineHelper->expects($this->any())->method('getEntityManager')->with('OroEmailBundle:Email')->will($this->returnValue($this->em)); $folder = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\EmailFolder')->disableOriginalConstructor()->getMock(); $this->userEmailOrigin->expects($this->any())->method('getFolder')->with(FolderType::SENT)->will($this->returnValue($folder)); $emailOriginRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock(); $emailOriginRepo->expects($this->any())->method('findOneBy')->with(['internalName' => InternalEmailOrigin::BAP])->will($this->returnValue($this->userEmailOrigin)); $this->em->expects($this->any())->method('getRepository')->with('OroEmailBundle:InternalEmailOrigin')->will($this->returnValue($emailOriginRepo)); $this->emailProcessor = new Processor($this->doctrineHelper, $this->mailer, new EmailAddressHelper(), $this->emailEntityBuilder, $this->emailOwnerProvider, $this->emailActivityManager, $this->securityFacadeLink, $this->dispatcher, new Mcrypt()); }
protected function setUp() { $this->service = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\SecurityContext')->disableOriginalConstructor()->getMock(); $this->securityContextLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock(); $this->securityContextLink->expects($this->any())->method('getService')->willReturn($this->service); $this->flashBag = $this->getMock('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface'); $this->userChecker = new UserChecker($this->securityContextLink, $this->flashBag); }
public function setUp() { $this->configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock(); $this->emailAttachmentManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Manager\\EmailAttachmentManager')->disableOriginalConstructor()->getMock(); $this->activityListProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\EmailActivityListProvider')->disableOriginalConstructor()->getMock(); $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock(); $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->disableOriginalConstructor()->getMock(); $this->securityFacadeLink->expects($this->once())->method('getService')->willReturn($this->securityFacade); $this->chainProvider = $this->getMockBuilder('Oro\\Bundle\\ActivityListBundle\\Provider\\ActivityListChainProvider')->disableOriginalConstructor()->getMock(); $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $this->listener = new EmailBodyAddListener($this->emailAttachmentManager, $this->configProvider, $this->activityListProvider, $this->securityFacadeLink, $this->chainProvider, $this->entityManager); }
protected function setUp() { $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $this->doctrineHelper = $this->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\DoctrineHelper')->disableOriginalConstructor()->getMock(); $this->mailer = $this->getMockBuilder('\\Swift_Mailer')->disableOriginalConstructor()->getMock(); $this->emailEntityBuilder = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Builder\\EmailEntityBuilder')->disableOriginalConstructor()->getMock(); $this->emailOwnerProvider = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Provider\\EmailOwnerProvider')->disableOriginalConstructor()->getMock(); $this->dispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->disableOriginalConstructor()->getMock(); $this->emailActivityManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Manager\\EmailActivityManager')->disableOriginalConstructor()->getMock(); $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->setMethods(['getLoggedUser', 'getOrganization'])->disableOriginalConstructor()->getMock(); $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->setMethods(['getService'])->disableOriginalConstructor()->getMock(); $this->securityFacadeLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityFacade)); $this->securityFacade->expects($this->any())->method('getOrganization')->will($this->returnValue($this->getTestOrganization())); $this->doctrineHelper->expects($this->any())->method('getEntityManager')->with('OroEmailBundle:Email')->will($this->returnValue($this->em)); $this->emailProcessor = new Processor($this->doctrineHelper, $this->mailer, new EmailAddressHelper(), $this->emailEntityBuilder, $this->emailOwnerProvider, $this->emailActivityManager, $this->securityFacadeLink, $this->dispatcher); }
protected function setUp() { $this->emailCacheManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Cache\\EmailCacheManager')->disableOriginalConstructor()->getMock(); $filesystemMap = $this->getMockBuilder('Knp\\Bundle\\GaufretteBundle\\FilesystemMap')->disableOriginalConstructor()->getMock(); $this->filesystem = $this->getMockBuilder('Gaufrette\\Filesystem')->setMethods(['delete', 'write', 'has'])->disableOriginalConstructor()->getMock(); $filesystemMap->expects($this->once())->method('get')->with('attachments')->will($this->returnValue($this->filesystem)); $this->registry = $this->getMockBuilder('Doctrine\\Bundle\\DoctrineBundle\\Registry')->disableOriginalConstructor()->getMock(); $this->configFileValidator = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\Validator\\ConfigFileValidator')->disableOriginalConstructor()->getMock(); $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface'); $this->kernel->expects($this->once())->method('getRootDir')->willReturn(''); $this->om = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMock(); $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->om)); $this->securityFacade = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\SecurityFacade')->setMethods(['getLoggedUser'])->disableOriginalConstructor()->getMock(); $this->securityFacadeLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->setMethods(['getService'])->disableOriginalConstructor()->getMock(); $this->securityFacadeLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityFacade)); $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $this->attachment = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\Entity\\Attachment')->setMethods(['supportTarget'])->disableOriginalConstructor()->getMock(); $this->attachmentConfig = $this->getMockBuilder('Oro\\Bundle\\AttachmentBundle\\EntityConfig\\AttachmentConfig')->disableOriginalConstructor()->getMock(); $this->emailAttachmentManager = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Manager\\EmailAttachmentManager')->setMethods(['getAttachmentFullPath', 'buildAttachmentInstance'])->setConstructorArgs([$filesystemMap, $this->em, $this->kernel, $this->securityFacadeLink, $this->configFileValidator, $this->attachmentConfig])->getMock(); $this->emailAttachmentManager->expects($this->any())->method('getAttachmentFullPath')->willReturn(__DIR__ . '/../Fixtures/attachment/test.txt'); }
protected function setUp() { $this->pm = $this->getMockBuilder('Oro\\Bundle\\DistributionBundle\\Manager\\PackageManager')->disableOriginalConstructor()->getMock(); $this->pml = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock(); $this->pml->expects($this->any())->method('getService')->will($this->returnValue($this->pm)); }