37 $templateService = $this->getMock(
'TYPO3\\CMS\\Core\\TypoScript\\TemplateService', array(
'getFileName',
'linkData'));
38 $this->tsfe = $this->getMock(
'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(
'dummy'), array(),
'', FALSE);
39 $this->tsfe->tmpl = $templateService;
40 $this->tsfe->config = array();
41 $this->tsfe->page = array();
42 $sysPageMock = $this->getMock(
'TYPO3\\CMS\\Frontend\\Page\\PageRepository', array(
'getRawRecord'));
43 $this->tsfe->sys_page = $sysPageMock;
45 $GLOBALS[
'TSFE']->csConvObj = new \TYPO3\CMS\Core\Charset\CharsetConverter();
46 $GLOBALS[
'TSFE']->renderCharset =
'utf-8';
48 $contentObject = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(
'dummy'));
49 $this->subject = $this->getMock(
'TYPO3\CMS\Frontend\ContentObject\FilesContentObject', array(
'dummy'), array($contentObject));
57 'One file reference' => array(
60 'renderObj' =>
'TEXT',
61 'renderObj.' => array(
62 'data' =>
'file:current:name',
68 'One file reference with begin higher than allowed' => array(
72 'renderObj' =>
'TEXT',
73 'renderObj.' => array(
74 'data' =>
'file:current:name',
80 'One file reference with maxItems higher than allowed' => array(
84 'renderObj' =>
'TEXT',
85 'renderObj.' => array(
86 'data' =>
'file:current:name',
92 'Multiple file references' => array(
94 'references' =>
'1,2,3',
95 'renderObj' =>
'TEXT',
96 'renderObj.' => array(
97 'data' =>
'file:current:name',
101 '<p>File 1</p><p>File 2</p><p>File 3</p>',
103 'Multiple file references with begin' => array(
105 'references' =>
'1,2,3',
107 'renderObj' =>
'TEXT',
108 'renderObj.' => array(
109 'data' =>
'file:current:name',
110 'wrap' =>
'<p>|</p>',
113 '<p>File 2</p><p>File 3</p>',
115 'Multiple file references with negative begin' => array(
117 'references' =>
'1,2,3',
119 'renderObj' =>
'TEXT',
120 'renderObj.' => array(
121 'data' =>
'file:current:name',
122 'wrap' =>
'<p>|</p>',
125 '<p>File 1</p><p>File 2</p><p>File 3</p>',
127 'Multiple file references with maxItems' => array(
129 'references' =>
'1,2,3',
131 'renderObj' =>
'TEXT',
132 'renderObj.' => array(
133 'data' =>
'file:current:name',
134 'wrap' =>
'<p>|</p>',
137 '<p>File 1</p><p>File 2</p>',
139 'Multiple file references with negative maxItems' => array(
141 'references' =>
'1,2,3',
143 'renderObj' =>
'TEXT',
144 'renderObj.' => array(
145 'data' =>
'file:current:name',
146 'wrap' =>
'<p>|</p>',
151 'Multiple file references with begin and maxItems' => array(
153 'references' =>
'1,2,3',
156 'renderObj' =>
'TEXT',
157 'renderObj.' => array(
158 'data' =>
'file:current:name',
159 'wrap' =>
'<p>|</p>',
164 'Multiple file references unsorted' => array(
166 'references' =>
'1,3,2',
167 'renderObj' =>
'TEXT',
168 'renderObj.' => array(
169 'data' =>
'file:current:name',
170 'wrap' =>
'<p>|</p>',
173 '<p>File 1</p><p>File 3</p><p>File 2</p>',
175 'Multiple file references sorted by name' => array(
177 'references' =>
'3,1,2',
179 'renderObj' =>
'TEXT',
180 'renderObj.' => array(
181 'data' =>
'file:current:name',
182 'wrap' =>
'<p>|</p>',
185 '<p>File 1</p><p>File 2</p><p>File 3</p>',
195 $fileReferenceMap = array();
196 for ($i = 1; $i < 4; $i++) {
197 $fileReference = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\FileReference', array(), array(),
'', FALSE);
198 $fileReference->expects($this->any())
200 ->will($this->returnValue(
'File ' . $i));
201 $fileReference->expects($this->any())
202 ->method(
'hasProperty')
204 ->will($this->returnValue(TRUE));
205 $fileReference->expects($this->any())
206 ->method(
'getProperty')
208 ->will($this->returnValue(
'File ' . $i));
210 $fileReferenceMap[] = array($i, array(), FALSE, $fileReference);
213 $resourceFactory = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
214 $resourceFactory->expects($this->any())
215 ->method(
'getFileReferenceObject')
216 ->will($this->returnValueMap($fileReferenceMap));
217 $this->subject->setFileFactory($resourceFactory);
219 $this->assertSame($expected, $this->subject->render($configuration));
230 'renderObj' =>
'TEXT',
231 'renderObj.' => array(
232 'data' =>
'file:current:name',
233 'wrap' =>
'<p>|</p>',
238 'One file with begin higher than allowed' => array(
242 'renderObj' =>
'TEXT',
243 'renderObj.' => array(
244 'data' =>
'file:current:name',
245 'wrap' =>
'<p>|</p>',
250 'One file with maxItems higher than allowed' => array(
254 'renderObj' =>
'TEXT',
255 'renderObj.' => array(
256 'data' =>
'file:current:name',
257 'wrap' =>
'<p>|</p>',
262 'Multiple files' => array(
265 'renderObj' =>
'TEXT',
266 'renderObj.' => array(
267 'data' =>
'file:current:name',
268 'wrap' =>
'<p>|</p>',
271 '<p>File 1</p><p>File 2</p><p>File 3</p>',
273 'Multiple files with begin' => array(
277 'renderObj' =>
'TEXT',
278 'renderObj.' => array(
279 'data' =>
'file:current:name',
280 'wrap' =>
'<p>|</p>',
283 '<p>File 2</p><p>File 3</p>',
285 'Multiple files with negative begin' => array(
289 'renderObj' =>
'TEXT',
290 'renderObj.' => array(
291 'data' =>
'file:current:name',
292 'wrap' =>
'<p>|</p>',
295 '<p>File 1</p><p>File 2</p><p>File 3</p>',
297 'Multiple files with maxItems' => array(
301 'renderObj' =>
'TEXT',
302 'renderObj.' => array(
303 'data' =>
'file:current:name',
304 'wrap' =>
'<p>|</p>',
307 '<p>File 1</p><p>File 2</p>',
309 'Multiple files with negative maxItems' => array(
313 'renderObj' =>
'TEXT',
314 'renderObj.' => array(
315 'data' =>
'file:current:name',
316 'wrap' =>
'<p>|</p>',
321 'Multiple files with begin and maxItems' => array(
326 'renderObj' =>
'TEXT',
327 'renderObj.' => array(
328 'data' =>
'file:current:name',
329 'wrap' =>
'<p>|</p>',
334 'Multiple files unsorted' => array(
337 'renderObj' =>
'TEXT',
338 'renderObj.' => array(
339 'data' =>
'file:current:name',
340 'wrap' =>
'<p>|</p>',
343 '<p>File 1</p><p>File 3</p><p>File 2</p>',
345 'Multiple files sorted by name' => array(
349 'renderObj' =>
'TEXT',
350 'renderObj.' => array(
351 'data' =>
'file:current:name',
352 'wrap' =>
'<p>|</p>',
355 '<p>File 1</p><p>File 2</p><p>File 3</p>',
366 for ($i = 1; $i < 4; $i++) {
367 $file = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\File', array(), array(),
'', FALSE);
368 $file->expects($this->any())
370 ->will($this->returnValue(
'File ' . $i));
371 $file->expects($this->any())
372 ->method(
'hasProperty')
374 ->will($this->returnValue(TRUE));
375 $file->expects($this->any())
376 ->method(
'getProperty')
378 ->will($this->returnValue(
'File ' . $i));
380 $fileMap[] = array($i, array(), $file);
383 $resourceFactory = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
384 $resourceFactory->expects($this->any())
385 ->method(
'getFileObject')
386 ->will($this->returnValueMap($fileMap));
387 $this->subject->setFileFactory($resourceFactory);
389 $this->assertSame($expected, $this->subject->render($configuration));
397 'One collection' => array(
399 'collections' =>
'1',
400 'renderObj' =>
'TEXT',
401 'renderObj.' => array(
402 'data' =>
'file:current:name',
403 'wrap' =>
'<p>|</p>',
406 '<p>File 1</p><p>File 2</p><p>File 3</p>',
408 'One collection with begin' => array(
410 'collections' =>
'1',
412 'renderObj' =>
'TEXT',
413 'renderObj.' => array(
414 'data' =>
'file:current:name',
415 'wrap' =>
'<p>|</p>',
418 '<p>File 2</p><p>File 3</p>',
420 'One collection with begin higher than allowed' => array(
422 'collections' =>
'1',
424 'renderObj' =>
'TEXT',
425 'renderObj.' => array(
426 'data' =>
'file:current:name',
427 'wrap' =>
'<p>|</p>',
432 'One collection with maxItems' => array(
434 'collections' =>
'1',
436 'renderObj' =>
'TEXT',
437 'renderObj.' => array(
438 'data' =>
'file:current:name',
439 'wrap' =>
'<p>|</p>',
442 '<p>File 1</p><p>File 2</p>',
444 'One collection with maxItems higher than allowed' => array(
446 'collections' =>
'1',
448 'renderObj' =>
'TEXT',
449 'renderObj.' => array(
450 'data' =>
'file:current:name',
451 'wrap' =>
'<p>|</p>',
454 '<p>File 1</p><p>File 2</p><p>File 3</p>',
456 'One collections with begin and maxItems' => array(
458 'collections' =>
'1',
461 'renderObj' =>
'TEXT',
462 'renderObj.' => array(
463 'data' =>
'file:current:name',
464 'wrap' =>
'<p>|</p>',
469 'Multiple collections' => array(
471 'collections' =>
'1,2,3',
472 'renderObj' =>
'TEXT',
473 'renderObj.' => array(
474 'data' =>
'file:current:name',
475 'wrap' =>
'<p>|</p>',
478 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
480 'Multiple collections with begin' => array(
482 'collections' =>
'1,2,3',
484 'renderObj' =>
'TEXT',
485 'renderObj.' => array(
486 'data' =>
'file:current:name',
487 'wrap' =>
'<p>|</p>',
490 '<p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
492 'Multiple collections with negative begin' => array(
494 'collections' =>
'1,2,3',
496 'renderObj' =>
'TEXT',
497 'renderObj.' => array(
498 'data' =>
'file:current:name',
499 'wrap' =>
'<p>|</p>',
502 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
504 'Multiple collections with maxItems' => array(
506 'collections' =>
'1,2,3',
508 'renderObj' =>
'TEXT',
509 'renderObj.' => array(
510 'data' =>
'file:current:name',
511 'wrap' =>
'<p>|</p>',
514 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p>',
516 'Multiple collections with negative maxItems' => array(
518 'collections' =>
'1,2,3',
520 'renderObj' =>
'TEXT',
521 'renderObj.' => array(
522 'data' =>
'file:current:name',
523 'wrap' =>
'<p>|</p>',
528 'Multiple collections with begin and maxItems' => array(
530 'collections' =>
'1,2,3',
533 'renderObj' =>
'TEXT',
534 'renderObj.' => array(
535 'data' =>
'file:current:name',
536 'wrap' =>
'<p>|</p>',
539 '<p>File 5</p><p>File 6</p><p>File 7</p>',
541 'Multiple collections unsorted' => array(
543 'collections' =>
'1,3,2',
544 'renderObj' =>
'TEXT',
545 'renderObj.' => array(
546 'data' =>
'file:current:name',
547 'wrap' =>
'<p>|</p>',
550 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 7</p><p>File 8</p><p>File 9</p><p>File 4</p><p>File 5</p><p>File 6</p>',
552 'Multiple collections sorted by name' => array(
554 'collections' =>
'3,1,2',
556 'renderObj' =>
'TEXT',
557 'renderObj.' => array(
558 'data' =>
'file:current:name',
559 'wrap' =>
'<p>|</p>',
562 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
572 $collectionMap = array();
574 for ($i = 1; $i < 4; $i++) {
575 $fileReferenceArray = array();
576 for ($j = 1; $j < 4; $j++) {
577 $fileReference = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\FileReference', array(), array(),
'', FALSE);
578 $fileReference->expects($this->any())
580 ->will($this->returnValue(
'File ' . $fileCount));
581 $fileReference->expects($this->any())
582 ->method(
'hasProperty')
584 ->will($this->returnValue(TRUE));
585 $fileReference->expects($this->any())
586 ->method(
'getProperty')
588 ->will($this->returnValue(
'File ' . $fileCount));
590 $fileReferenceArray[] = $fileReference;
594 $collection = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\Collection\\StaticFileCollection', array(), array(),
'', FALSE);
595 $collection->expects($this->any())
597 ->will($this->returnValue($fileReferenceArray));
599 $collectionMap[] = array($i, $collection);
602 $collectionRepository = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\FileCollectionRepository');
603 $collectionRepository->expects($this->any())
604 ->method(
'findByUid')
605 ->will($this->returnValueMap($collectionMap));
606 $this->subject->setCollectionRepository($collectionRepository);
608 $this->assertSame($expected, $this->subject->render($configuration));
616 'One folder' => array(
618 'folders' =>
'1:myfolder/',
619 'renderObj' =>
'TEXT',
620 'renderObj.' => array(
621 'data' =>
'file:current:name',
622 'wrap' =>
'<p>|</p>',
625 '<p>File 1</p><p>File 2</p><p>File 3</p>',
627 'One folder with begin' => array(
629 'folders' =>
'1:myfolder/',
631 'renderObj' =>
'TEXT',
632 'renderObj.' => array(
633 'data' =>
'file:current:name',
634 'wrap' =>
'<p>|</p>',
637 '<p>File 2</p><p>File 3</p>',
639 'One folder with begin higher than allowed' => array(
641 'folders' =>
'1:myfolder/',
643 'renderObj' =>
'TEXT',
644 'renderObj.' => array(
645 'data' =>
'file:current:name',
646 'wrap' =>
'<p>|</p>',
651 'One folder with maxItems' => array(
653 'folders' =>
'1:myfolder/',
655 'renderObj' =>
'TEXT',
656 'renderObj.' => array(
657 'data' =>
'file:current:name',
658 'wrap' =>
'<p>|</p>',
661 '<p>File 1</p><p>File 2</p>',
663 'One folder with maxItems higher than allowed' => array(
665 'folders' =>
'1:myfolder/',
667 'renderObj' =>
'TEXT',
668 'renderObj.' => array(
669 'data' =>
'file:current:name',
670 'wrap' =>
'<p>|</p>',
673 '<p>File 1</p><p>File 2</p><p>File 3</p>',
675 'One folder with begin and maxItems' => array(
677 'folders' =>
'1:myfolder/',
680 'renderObj' =>
'TEXT',
681 'renderObj.' => array(
682 'data' =>
'file:current:name',
683 'wrap' =>
'<p>|</p>',
688 'Multiple folders' => array(
690 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
691 'renderObj' =>
'TEXT',
692 'renderObj.' => array(
693 'data' =>
'file:current:name',
694 'wrap' =>
'<p>|</p>',
697 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
699 'Multiple folders with begin' => array(
701 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
703 'renderObj' =>
'TEXT',
704 'renderObj.' => array(
705 'data' =>
'file:current:name',
706 'wrap' =>
'<p>|</p>',
709 '<p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
711 'Multiple folders with negative begin' => array(
713 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
715 'renderObj' =>
'TEXT',
716 'renderObj.' => array(
717 'data' =>
'file:current:name',
718 'wrap' =>
'<p>|</p>',
721 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
723 'Multiple folders with maxItems' => array(
725 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
727 'renderObj' =>
'TEXT',
728 'renderObj.' => array(
729 'data' =>
'file:current:name',
730 'wrap' =>
'<p>|</p>',
733 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p>',
735 'Multiple folders with negative maxItems' => array(
737 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
739 'renderObj' =>
'TEXT',
740 'renderObj.' => array(
741 'data' =>
'file:current:name',
742 'wrap' =>
'<p>|</p>',
747 'Multiple folders with begin and maxItems' => array(
749 'folders' =>
'1:myfolder/,2:myfolder/,3:myfolder/',
752 'renderObj' =>
'TEXT',
753 'renderObj.' => array(
754 'data' =>
'file:current:name',
755 'wrap' =>
'<p>|</p>',
758 '<p>File 5</p><p>File 6</p><p>File 7</p>',
760 'Multiple folders unsorted' => array(
762 'folders' =>
'1:myfolder/,3:myfolder/,2:myfolder/',
763 'renderObj' =>
'TEXT',
764 'renderObj.' => array(
765 'data' =>
'file:current:name',
766 'wrap' =>
'<p>|</p>',
769 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 7</p><p>File 8</p><p>File 9</p><p>File 4</p><p>File 5</p><p>File 6</p>',
771 'Multiple folders sorted by name' => array(
773 'folders' =>
'3:myfolder/,1:myfolder/,2:myfolder/',
775 'renderObj' =>
'TEXT',
776 'renderObj.' => array(
777 'data' =>
'file:current:name',
778 'wrap' =>
'<p>|</p>',
781 '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p><p>File 6</p><p>File 7</p><p>File 8</p><p>File 9</p>',
791 $folderMap = array();
793 for ($i = 1; $i < 4; $i++) {
794 $fileArray = array();
795 for ($j = 1; $j < 4; $j++) {
796 $file = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\File', array(), array(),
'', FALSE);
797 $file->expects($this->any())
799 ->will($this->returnValue(
'File ' . $fileCount));
800 $file->expects($this->any())
801 ->method(
'hasProperty')
803 ->will($this->returnValue(TRUE));
804 $file->expects($this->any())
805 ->method(
'getProperty')
807 ->will($this->returnValue(
'File ' . $fileCount));
809 $fileArray[] = $file;
813 $folder = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\Folder', array(), array(),
'', FALSE);
814 $folder->expects($this->any())
816 ->will($this->returnValue($fileArray));
818 $folderMap[] = array($i .
':myfolder/', $folder);
821 $fileFactory = $this->getMock(
'TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
822 $fileFactory->expects($this->any())
823 ->method(
'getFolderObjectFromCombinedIdentifier')
824 ->will($this->returnValueMap($folderMap));
825 $this->subject->setFileFactory($fileFactory);
827 $this->assertSame($expected, $this->subject->render($configuration));
renderReturnsFilesForFilesDataProvider()
renderReturnsFilesForFiles($configuration, $expected)
renderReturnsFilesForFileReferencesDataProvider()
renderReturnsFilesForCollections($configuration, $expected)
renderReturnsFilesForFileReferences($configuration, $expected)
renderReturnsFilesForFolders($configuration, $expected)
renderReturnsFilesForCollectionsDataProvider()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
renderReturnsFilesForFoldersDataProvider()