51 $this->fileResourceMock = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\File', array(
'toArray',
'getModificationTime',
'getExtension'), array(),
'', FALSE);
52 $this->folderResourceMock = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\Folder', array(
'getIdentifier'), array(),
'', FALSE);
53 $this->mockFileProcessor = $this->getMock(
'TYPO3\\CMS\\Core\\Utility\\File\ExtendedFileUtility', array(
'getErrorMessages'), array(),
'', FALSE);
55 $this->fileResourceMock->expects($this->any())->method(
'toArray')->will($this->returnValue(array(
'id' =>
'foo')));
56 $this->fileResourceMock->expects($this->any())->method(
'getModificationTime')->will($this->returnValue(123456789));
57 $this->fileResourceMock->expects($this->any())->method(
'getExtension')->will($this->returnValue(
'html'));
64 $this->fileController = $this->
getAccessibleMock(
'TYPO3\\CMS\\Backend\\Controller\\File\\FileController', array(
'dummy'));
66 $this->folderResourceMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue(
'bar'));
68 $this->mockFileProcessor->expects($this->any())->method(
'getErrorMessages')->will($this->returnValue(array()));
70 $this->assertTrue($this->fileController->_call(
'flattenResultDataValue', TRUE));
71 $this->assertSame(array(), $this->fileController->_call(
'flattenResultDataValue', array()));
77 'iconClasses' =>
't3-icon t3-icon-mimetypes t3-icon-mimetypes-text t3-icon-text-html' 79 $this->fileController->_call(
'flattenResultDataValue', $this->fileResourceMock)
84 $this->fileController->_call(
'flattenResultDataValue', $this->folderResourceMock)
92 $this->fileController = $this->
getAccessibleMock(
'TYPO3\\CMS\\Backend\\Controller\\File\\FileController', array(
'init',
'main'));
93 $this->mockAjaxRequestHandler = $this->getMock(
'TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', array(
'addContent',
'setContentFormat'), array(),
'', FALSE);
95 $fileData = array(
'delete' => array(TRUE));
96 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
97 $this->fileController->_set(
'fileData', $fileData);
98 $this->fileController->_set(
'redirect', FALSE);
100 $this->fileController->expects($this->once())->method(
'init');
101 $this->fileController->expects($this->once())->method(
'main');
102 $this->mockAjaxRequestHandler->expects($this->once())->method(
'addContent')->with(
'result', $fileData);
103 $this->mockAjaxRequestHandler->expects($this->once())->method(
'setContentFormat')->with(
'json');
105 $this->fileController->processAjaxRequest(array(), $this->mockAjaxRequestHandler);
112 $this->fileController = $this->
getAccessibleMock(
'TYPO3\CMS\\Backend\\Controller\\File\\FileController', array(
'init',
'main'));
113 $this->mockAjaxRequestHandler = $this->getMock(
'TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', array(
'addContent',
'setContentFormat'), array(),
'', FALSE);
115 $fileData = array(
'editfile' => array(TRUE));
116 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
117 $this->fileController->_set(
'fileData', $fileData);
118 $this->fileController->_set(
'redirect', FALSE);
120 $this->fileController->expects($this->once())->method(
'init');
121 $this->fileController->expects($this->once())->method(
'main');
122 $this->mockAjaxRequestHandler->expects($this->once())->method(
'addContent')->with(
'result', $fileData);
123 $this->mockAjaxRequestHandler->expects($this->once())->method(
'setContentFormat')->with(
'json');
125 $this->fileController->processAjaxRequest(array(), $this->mockAjaxRequestHandler);
132 $this->fileController = $this->
getAccessibleMock(
'TYPO3\\CMS\\Backend\\Controller\\File\\FileController', array(
'init',
'main'));
133 $this->mockAjaxRequestHandler = $this->getMock(
'TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', array(
'addContent',
'setContentFormat'), array(),
'', FALSE);
135 $fileData = array(
'unzip' => array(TRUE));
136 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
137 $this->fileController->_set(
'fileData', $fileData);
138 $this->fileController->_set(
'redirect', FALSE);
140 $this->fileController->expects($this->once())->method(
'init');
141 $this->fileController->expects($this->once())->method(
'main');
142 $this->mockAjaxRequestHandler->expects($this->once())->method(
'addContent')->with(
'result', $fileData);
143 $this->mockAjaxRequestHandler->expects($this->once())->method(
'setContentFormat')->with(
'json');
145 $this->fileController->processAjaxRequest(array(), $this->mockAjaxRequestHandler);
152 $this->fileController = $this->
getAccessibleMock(
'TYPO3\\CMS\Backend\\Controller\\File\\FileController', array(
'init',
'main'));
153 $this->mockAjaxRequestHandler = $this->getMock(
'TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', array(
'addContent',
'setContentFormat'), array(),
'', FALSE);
155 $fileData = array(
'upload' => array(array($this->fileResourceMock)));
156 $result = array(
'upload' => array(array(
158 'date' =>
'29-11-73',
159 'iconClasses' =>
't3-icon t3-icon-mimetypes t3-icon-mimetypes-text t3-icon-text-html' 161 $this->fileController->_set(
'fileProcessor', $this->mockFileProcessor);
162 $this->fileController->_set(
'fileData', $fileData);
163 $this->fileController->_set(
'redirect', FALSE);
165 $this->fileController->expects($this->once())->method(
'init');
166 $this->fileController->expects($this->once())->method(
'main');
167 $this->mockAjaxRequestHandler->expects($this->once())->method(
'addContent')->with(
'result',
$result);
168 $this->mockAjaxRequestHandler->expects($this->once())->method(
'setContentFormat')->with(
'json');
170 $this->fileController->processAjaxRequest(array(), $this->mockAjaxRequestHandler);
flattenResultDataValueFlattensFileAndFolderResourcesButReturnsAnythingElseAsIs()
processAjaxRequestUnzipProcessActuallyDoesNotChangeFileData()
processAjaxRequestUploadProcess()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
processAjaxRequestEditFileProcessActuallyDoesNotChangeFileData()
processAjaxRequestDeleteProcessActuallyDoesNotChangeFileData()