/**
  * @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\MessageController
  */
 public function testTestMailActionAddsQueueMessagesToFlashMessengerWhenQueueServiceIsSet()
 {
     $paramsMock = $this->mockFactory->getParamsMock(1);
     $requestMock = $this->mockFactory->getRequestMock([]);
     $this->sut->setRequest($requestMock);
     $flashMessengerMock = $this->mockFactory->getFlashMessengerPluginMock(2, 0);
     $responseMock = $this->mockFactory->getResponseMock();
     $redirectMock = $this->mockFactory->getRedirectPluginMock($responseMock);
     $pluginManagerMock = $this->mockFactory->getPluginMock($paramsMock, $flashMessengerMock, $flashMessengerMock, $redirectMock);
     $this->sut->setPluginManager($pluginManagerMock);
     $this->repositoryMock->expects($this->any())->method('getWithSubscribers')->will($this->returnValue($this->getMessageMockWithQueue()));
     $this->managerMock->expects($this->any())->method('queueTestMails')->will($this->returnValue(2));
     $this->managerMock->expects($this->any())->method('saveEntity')->will($this->returnValue(true));
     $queueServiceMock = $this->getMockBuilder('DmMailer\\Service\\Queue')->setMethods(['process'])->disableOriginalConstructor()->getMock();
     $queueServiceMock->expects($this->once())->method('process')->will($this->returnValue(1));
     $this->sut->setQueueService($queueServiceMock);
     $actualResult = $this->sut->testMailAction();
     $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);
 }