Exemple #1
0
 /**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return CampaignController
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     if ($serviceLocator instanceof ControllerManager) {
         $serviceLocator = $serviceLocator->getServiceLocator();
     }
     /** @var CampaignRepository $campaignRepository */
     $campaignRepository = $serviceLocator->get('DmMailer\\Repository\\Campaign');
     /** @var MessageRepository $messageRepository */
     $messageRepository = $serviceLocator->get('DmMailer\\Repository\\Message');
     /** @var CampaignManager $campaignManager */
     $campaignManager = $serviceLocator->get('DmMailer\\Manager\\Campaign');
     /** @var UserText $userText */
     $userText = $serviceLocator->get('DmCommon\\View\\Helper\\UserText');
     $controller = new CampaignController($campaignRepository, $messageRepository, $campaignManager, $userText);
     /** @var OptionsHelper $options */
     $options = $serviceLocator->get('DmTinymce\\Helper\\Options');
     $controller->setTinyMceLang($options->getTinymceLang());
     return $controller;
 }
 /**
  * @covers DmMailerAdmin\Controller\CampaignController
  */
 public function testUpdateActionReturnsViewWhenHandlePostSuccess()
 {
     $responseMock = $this->mockFactory->getResponseMock();
     $redirectPluginMock = $this->mockFactory->getRedirectPluginMock($responseMock);
     $paramsPluginMock = $this->mockFactory->getParamsMock(1);
     $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(1, 0);
     $pluginManagerMock = $this->mockFactory->getPluginMock($paramsPluginMock, $flashMessengerMock, $redirectPluginMock);
     $this->sut->setPluginManager($pluginManagerMock);
     $this->repositoryMock->expects($this->any())->method('getOneById')->will($this->returnValue($this->getCampaignMock()));
     $this->messageRepoMock->expects($this->any())->method('getSystemMessage')->will($this->returnValue($this->getMessageMock()));
     $this->managerMock->expects($this->once())->method('handlePost')->will($this->returnValue(true));
     $actualResult = $this->sut->updateAction();
     $this->assertSame($responseMock, $actualResult);
 }