/** * @covers DmFileman\Controller\ListController */ public function testRefreshActionRedirectsToListPage() { $responseMock = $this->mockFactory->getResponseMock(); $redirectMock = $this->mockFactory->getRedirectPluginMock($responseMock); $pluginMock = $this->mockFactory->getPluginMock($redirectMock); $this->sut->setPluginManager($pluginMock); $actualResult = $this->sut->refreshAction(); $this->assertEquals($responseMock, $actualResult); }
/** * @covers DmFileman\Controller\CreateDirectoryController */ public function testCreateActionAddsSuccessMessageToFlashMessengerWhenFormIsValid() { $responseMock = $this->mockFactory->getResponseMock(); $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(1, 0); $redirectMock = $this->mockFactory->getRedirectPluginMock($responseMock); $pluginMock = $this->mockFactory->getPluginMock($flashMessengerMock, $redirectMock); $this->sut->setPluginManager($pluginMock); $requestMock = $this->mockFactory->getRequestMock([]); $this->sut->setRequest($requestMock); $inputFilterMock = $this->getMock('Zend\\InputFilter\\InputFilter', ['init']); $this->createDirFormMock->expects($this->once())->method('getInputFilter')->will($this->returnValue($inputFilterMock)); $this->createDirFormMock->expects($this->once())->method('isValid')->will($this->returnValue(true)); $this->createDirFormMock->expects($this->once())->method('getData')->will($this->returnValue(['directoryName' => 'foo'])); $this->fileManagerMock->expects($this->once())->method('create')->will($this->returnValue(true)); $this->sut->setCurrentPath(''); $actualResult = $this->sut->createAction(); $this->assertEquals($responseMock, $actualResult); }
/** * @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); }
/** * @covers DmFileman\Controller\UploadFileController */ public function testUploadActionCreatesThumbnail() { $responseMock = $this->mockFactory->getResponseMock(); $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(1, 0); $redirectMock = $this->mockFactory->getRedirectPluginMock($responseMock); $pluginMock = $this->mockFactory->getPluginMock($flashMessengerMock, $redirectMock); $this->sut->setPluginManager($pluginMock); $requestMock = $this->mockFactory->getRequestMock(new \SplFixedArray(0), new \SplFixedArray(0)); $this->sut->setRequest($requestMock); $inputFilterMock = $this->getMock('Zend\\InputFilter\\InputFilter', ['init', 'setCurrentDir']); $inputFilterMock->expects($this->any())->method('setCurrentDir')->will($this->returnSelf()); $this->uploadFileFormMock->expects($this->once())->method('getInputFilter')->will($this->returnValue($inputFilterMock)); $this->uploadFileFormMock->expects($this->once())->method('isValid')->will($this->returnValue(true)); $this->uploadFileFormMock->expects($this->once())->method('getData')->will($this->returnValue(['file' => ['type' => 'image/jpeg', 'tmp_name' => '']])); $this->thumbnailerMock->expects($this->once())->method('resizeOrigImage')->will($this->returnValue(true)); $this->sut->setCurrentPath(''); $actualResult = $this->sut->uploadAction(); $this->assertEquals($responseMock, $actualResult); }