2 namespace TYPO3\CMS\Backend\Tests\Unit\Controller\File;
60 $this->fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(
'toArray',
'getModificationTime',
'getExtension'), array(),
'',
false);
61 $this->folderResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array(
'getIdentifier'), array(),
'',
false);
62 $this->mockFileProcessor = $this->getMock(\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::class, array(
'getErrorMessages'), array(),
'',
false);
64 $this->fileResourceMock->expects($this->any())->method(
'toArray')->will($this->returnValue(array(
'id' =>
'foo')));
65 $this->fileResourceMock->expects($this->any())->method(
'getModificationTime')->will($this->returnValue(123456789));
66 $this->fileResourceMock->expects($this->any())->method(
'getExtension')->will($this->returnValue(
'html'));
77 $this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array(
'dummy'));
79 $this->folderResourceMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue(
'bar'));
81 $this->mockFileProcessor->expects($this->any())->method(
'getErrorMessages')->will($this->returnValue(array()));
83 $this->assertTrue($this->fileController->_call(
'flattenResultDataValue',
true));
84 $this->assertSame(array(), $this->fileController->_call(
'flattenResultDataValue', array()));
85 $result = $this->fileController->_call(
'flattenResultDataValue', $this->fileResourceMock);
86 $this->assertContains(
'<span class="t3js-icon icon icon-size-small icon-state-default icon-mimetypes-text-html" data-identifier="mimetypes-text-html">', $result[
'icon']);
87 unset($result[
'icon']);
99 $this->fileController->_call(
'flattenResultDataValue', $this->folderResourceMock)
108 $this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array(
'init',
'main'));
110 $fileData = array(
'delete' => array(
true));
111 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
112 $this->fileController->_set(
'fileData', $fileData);
113 $this->fileController->_set(
'redirect',
false);
115 $this->fileController->expects($this->once())->method(
'main');
117 $this->fileController->processAjaxRequest($this->request, $this->response);
125 $this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array(
'init',
'main'));
127 $fileData = array(
'editfile' => array(
true));
128 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
129 $this->fileController->_set(
'fileData', $fileData);
130 $this->fileController->_set(
'redirect',
false);
132 $this->fileController->expects($this->once())->method(
'main');
134 $this->fileController->processAjaxRequest($this->request, $this->response);
142 $this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array(
'init',
'main'));
144 $fileData = array(
'unzip' => array(
true));
145 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
146 $this->fileController->_set(
'fileData', $fileData);
147 $this->fileController->_set(
'redirect',
false);
149 $this->fileController->expects($this->once())->method(
'main');
151 $this->fileController->processAjaxRequest($this->request, $this->response);