/** * @covers DmMailerAdmin\Controller\QueueController */ public function testTrackActionReturnsRequestReturnedByManager() { $paramsMock = $this->mockFactory->getParamsMock(1); $pluginManagerMock = $this->mockFactory->getPluginMock($paramsMock); $this->sut->setPluginManager($pluginManagerMock); $responseMock = $this->mockFactory->getResponseMock(); $this->managerMock->expects($this->once())->method('trackQueueItem')->will($this->returnValue(true)); $this->managerMock->expects($this->once())->method('getImageResponse')->will($this->returnValue($responseMock)); $actualResult = $this->sut->trackAction(); $this->assertSame($responseMock, $actualResult); }
/** * @covers DmMailerAdmin\Controller\MessageController */ public function testToggleHaltActionSetsContentFalseOnSaveFailure() { $paramsMock = $this->mockFactory->getParamsMock(1); $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(-1, 0, -1, 1); $pluginManagerMock = $this->mockFactory->getPluginMock($paramsMock, $flashMessengerMock); $this->sut->setPluginManager($pluginManagerMock); $responseMock = $this->mockFactory->getResponseMock(); $this->repositoryMock->expects($this->any())->method('getOneById')->will($this->returnValue($this->getMessageMock())); $this->managerMock->expects($this->once())->method('saveEntity')->will($this->returnValue(false)); $responseMock->expects($this->once())->method('setContent')->with($this->equalTo('false')); $this->sut->setResponse($responseMock); $actualResult = $this->sut->toggleOnHaltAction(); $this->assertSame($responseMock, $actualResult); }
/** * @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); }
/** * @covers DmMailerAdmin\Controller\TemplateController */ public function testUpdateActionRedirectsOnHandlePostSuccess() { $paramsMock = $this->mockFactory->getParamsMock(1); $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(1, 0); $responseMock = $this->mockFactory->getResponseMock(); $redirectMock = $this->mockFactory->getRedirectPluginMock($responseMock); $pluginManagerMock = $this->mockFactory->getPluginMock($paramsMock, $flashMessengerMock, $redirectMock); $this->sut->setPluginManager($pluginManagerMock); $subscriberMock = $this->getTemplateMock(); $this->repositoryMock->expects($this->once())->method('getOneById')->will($this->returnValue($subscriberMock)); $this->managerMock->expects($this->once())->method('handlePost')->will($this->returnValue(true)); $actualResult = $this->sut->updateAction(); $this->assertSame($responseMock, $actualResult); }