TYPO3 CMS  TYPO3_6-2
FilesContentObjectTest.php
Go to the documentation of this file.
1 <?php
3 
22 
26  protected $subject = NULL;
27 
31  protected $tsfe = NULL;
32 
36  public function setUp() {
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;
44  $GLOBALS['TSFE'] = $this->tsfe;
45  $GLOBALS['TSFE']->csConvObj = new \TYPO3\CMS\Core\Charset\CharsetConverter();
46  $GLOBALS['TSFE']->renderCharset = 'utf-8';
47 
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));
50  }
51 
56  return array(
57  'One file reference' => array(
58  array(
59  'references' => '1',
60  'renderObj' => 'TEXT',
61  'renderObj.' => array(
62  'data' => 'file:current:name',
63  'wrap' => '<p>|</p>',
64  ),
65  ),
66  '<p>File 1</p>',
67  ),
68  'One file reference with begin higher than allowed' => array(
69  array(
70  'references' => '1',
71  'begin' => '1',
72  'renderObj' => 'TEXT',
73  'renderObj.' => array(
74  'data' => 'file:current:name',
75  'wrap' => '<p>|</p>',
76  ),
77  ),
78  '',
79  ),
80  'One file reference with maxItems higher than allowed' => array(
81  array(
82  'references' => '1',
83  'maxItems' => '2',
84  'renderObj' => 'TEXT',
85  'renderObj.' => array(
86  'data' => 'file:current:name',
87  'wrap' => '<p>|</p>',
88  ),
89  ),
90  '<p>File 1</p>',
91  ),
92  'Multiple file references' => array(
93  array(
94  'references' => '1,2,3',
95  'renderObj' => 'TEXT',
96  'renderObj.' => array(
97  'data' => 'file:current:name',
98  'wrap' => '<p>|</p>',
99  ),
100  ),
101  '<p>File 1</p><p>File 2</p><p>File 3</p>',
102  ),
103  'Multiple file references with begin' => array(
104  array(
105  'references' => '1,2,3',
106  'begin' => '1',
107  'renderObj' => 'TEXT',
108  'renderObj.' => array(
109  'data' => 'file:current:name',
110  'wrap' => '<p>|</p>',
111  ),
112  ),
113  '<p>File 2</p><p>File 3</p>',
114  ),
115  'Multiple file references with negative begin' => array(
116  array(
117  'references' => '1,2,3',
118  'begin' => '-1',
119  'renderObj' => 'TEXT',
120  'renderObj.' => array(
121  'data' => 'file:current:name',
122  'wrap' => '<p>|</p>',
123  ),
124  ),
125  '<p>File 1</p><p>File 2</p><p>File 3</p>',
126  ),
127  'Multiple file references with maxItems' => array(
128  array(
129  'references' => '1,2,3',
130  'maxItems' => '2',
131  'renderObj' => 'TEXT',
132  'renderObj.' => array(
133  'data' => 'file:current:name',
134  'wrap' => '<p>|</p>',
135  ),
136  ),
137  '<p>File 1</p><p>File 2</p>',
138  ),
139  'Multiple file references with negative maxItems' => array(
140  array(
141  'references' => '1,2,3',
142  'maxItems' => '-2',
143  'renderObj' => 'TEXT',
144  'renderObj.' => array(
145  'data' => 'file:current:name',
146  'wrap' => '<p>|</p>',
147  ),
148  ),
149  '',
150  ),
151  'Multiple file references with begin and maxItems' => array(
152  array(
153  'references' => '1,2,3',
154  'begin' => '1',
155  'maxItems' => '1',
156  'renderObj' => 'TEXT',
157  'renderObj.' => array(
158  'data' => 'file:current:name',
159  'wrap' => '<p>|</p>',
160  ),
161  ),
162  '<p>File 2</p>',
163  ),
164  'Multiple file references unsorted' => array(
165  array(
166  'references' => '1,3,2',
167  'renderObj' => 'TEXT',
168  'renderObj.' => array(
169  'data' => 'file:current:name',
170  'wrap' => '<p>|</p>',
171  ),
172  ),
173  '<p>File 1</p><p>File 3</p><p>File 2</p>',
174  ),
175  'Multiple file references sorted by name' => array(
176  array(
177  'references' => '3,1,2',
178  'sorting' => 'name',
179  'renderObj' => 'TEXT',
180  'renderObj.' => array(
181  'data' => 'file:current:name',
182  'wrap' => '<p>|</p>',
183  ),
184  ),
185  '<p>File 1</p><p>File 2</p><p>File 3</p>',
186  ),
187  );
188  }
189 
194  public function renderReturnsFilesForFileReferences($configuration, $expected) {
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())
199  ->method('getName')
200  ->will($this->returnValue('File ' . $i));
201  $fileReference->expects($this->any())
202  ->method('hasProperty')
203  ->with('name')
204  ->will($this->returnValue(TRUE));
205  $fileReference->expects($this->any())
206  ->method('getProperty')
207  ->with('name')
208  ->will($this->returnValue('File ' . $i));
209 
210  $fileReferenceMap[] = array($i, array(), FALSE, $fileReference);
211  }
212 
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);
218 
219  $this->assertSame($expected, $this->subject->render($configuration));
220  }
221 
226  return array(
227  'One file' => array(
228  array(
229  'files' => '1',
230  'renderObj' => 'TEXT',
231  'renderObj.' => array(
232  'data' => 'file:current:name',
233  'wrap' => '<p>|</p>',
234  ),
235  ),
236  '<p>File 1</p>',
237  ),
238  'One file with begin higher than allowed' => array(
239  array(
240  'files' => '1',
241  'begin' => '1',
242  'renderObj' => 'TEXT',
243  'renderObj.' => array(
244  'data' => 'file:current:name',
245  'wrap' => '<p>|</p>',
246  ),
247  ),
248  '',
249  ),
250  'One file with maxItems higher than allowed' => array(
251  array(
252  'files' => '1',
253  'maxItems' => '2',
254  'renderObj' => 'TEXT',
255  'renderObj.' => array(
256  'data' => 'file:current:name',
257  'wrap' => '<p>|</p>',
258  ),
259  ),
260  '<p>File 1</p>',
261  ),
262  'Multiple files' => array(
263  array(
264  'files' => '1,2,3',
265  'renderObj' => 'TEXT',
266  'renderObj.' => array(
267  'data' => 'file:current:name',
268  'wrap' => '<p>|</p>',
269  ),
270  ),
271  '<p>File 1</p><p>File 2</p><p>File 3</p>',
272  ),
273  'Multiple files with begin' => array(
274  array(
275  'files' => '1,2,3',
276  'begin' => '1',
277  'renderObj' => 'TEXT',
278  'renderObj.' => array(
279  'data' => 'file:current:name',
280  'wrap' => '<p>|</p>',
281  ),
282  ),
283  '<p>File 2</p><p>File 3</p>',
284  ),
285  'Multiple files with negative begin' => array(
286  array(
287  'files' => '1,2,3',
288  'begin' => '-1',
289  'renderObj' => 'TEXT',
290  'renderObj.' => array(
291  'data' => 'file:current:name',
292  'wrap' => '<p>|</p>',
293  ),
294  ),
295  '<p>File 1</p><p>File 2</p><p>File 3</p>',
296  ),
297  'Multiple files with maxItems' => array(
298  array(
299  'files' => '1,2,3',
300  'maxItems' => '2',
301  'renderObj' => 'TEXT',
302  'renderObj.' => array(
303  'data' => 'file:current:name',
304  'wrap' => '<p>|</p>',
305  ),
306  ),
307  '<p>File 1</p><p>File 2</p>',
308  ),
309  'Multiple files with negative maxItems' => array(
310  array(
311  'files' => '1,2,3',
312  'maxItems' => '-2',
313  'renderObj' => 'TEXT',
314  'renderObj.' => array(
315  'data' => 'file:current:name',
316  'wrap' => '<p>|</p>',
317  ),
318  ),
319  '',
320  ),
321  'Multiple files with begin and maxItems' => array(
322  array(
323  'files' => '1,2,3',
324  'begin' => '1',
325  'maxItems' => '1',
326  'renderObj' => 'TEXT',
327  'renderObj.' => array(
328  'data' => 'file:current:name',
329  'wrap' => '<p>|</p>',
330  ),
331  ),
332  '<p>File 2</p>',
333  ),
334  'Multiple files unsorted' => array(
335  array(
336  'files' => '1,3,2',
337  'renderObj' => 'TEXT',
338  'renderObj.' => array(
339  'data' => 'file:current:name',
340  'wrap' => '<p>|</p>',
341  ),
342  ),
343  '<p>File 1</p><p>File 3</p><p>File 2</p>',
344  ),
345  'Multiple files sorted by name' => array(
346  array(
347  'files' => '3,1,2',
348  'sorting' => 'name',
349  'renderObj' => 'TEXT',
350  'renderObj.' => array(
351  'data' => 'file:current:name',
352  'wrap' => '<p>|</p>',
353  ),
354  ),
355  '<p>File 1</p><p>File 2</p><p>File 3</p>',
356  ),
357  );
358  }
359 
364  public function renderReturnsFilesForFiles($configuration, $expected) {
365  $fileMap = array();
366  for ($i = 1; $i < 4; $i++) {
367  $file = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
368  $file->expects($this->any())
369  ->method('getName')
370  ->will($this->returnValue('File ' . $i));
371  $file->expects($this->any())
372  ->method('hasProperty')
373  ->with('name')
374  ->will($this->returnValue(TRUE));
375  $file->expects($this->any())
376  ->method('getProperty')
377  ->with('name')
378  ->will($this->returnValue('File ' . $i));
379 
380  $fileMap[] = array($i, array(), $file);
381  }
382 
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);
388 
389  $this->assertSame($expected, $this->subject->render($configuration));
390  }
391 
396  return array(
397  'One collection' => array(
398  array(
399  'collections' => '1',
400  'renderObj' => 'TEXT',
401  'renderObj.' => array(
402  'data' => 'file:current:name',
403  'wrap' => '<p>|</p>',
404  ),
405  ),
406  '<p>File 1</p><p>File 2</p><p>File 3</p>',
407  ),
408  'One collection with begin' => array(
409  array(
410  'collections' => '1',
411  'begin' => '1',
412  'renderObj' => 'TEXT',
413  'renderObj.' => array(
414  'data' => 'file:current:name',
415  'wrap' => '<p>|</p>',
416  ),
417  ),
418  '<p>File 2</p><p>File 3</p>',
419  ),
420  'One collection with begin higher than allowed' => array(
421  array(
422  'collections' => '1',
423  'begin' => '3',
424  'renderObj' => 'TEXT',
425  'renderObj.' => array(
426  'data' => 'file:current:name',
427  'wrap' => '<p>|</p>',
428  ),
429  ),
430  '',
431  ),
432  'One collection with maxItems' => array(
433  array(
434  'collections' => '1',
435  'maxItems' => '2',
436  'renderObj' => 'TEXT',
437  'renderObj.' => array(
438  'data' => 'file:current:name',
439  'wrap' => '<p>|</p>',
440  ),
441  ),
442  '<p>File 1</p><p>File 2</p>',
443  ),
444  'One collection with maxItems higher than allowed' => array(
445  array(
446  'collections' => '1',
447  'maxItems' => '4',
448  'renderObj' => 'TEXT',
449  'renderObj.' => array(
450  'data' => 'file:current:name',
451  'wrap' => '<p>|</p>',
452  ),
453  ),
454  '<p>File 1</p><p>File 2</p><p>File 3</p>',
455  ),
456  'One collections with begin and maxItems' => array(
457  array(
458  'collections' => '1',
459  'begin' => '1',
460  'maxItems' => '1',
461  'renderObj' => 'TEXT',
462  'renderObj.' => array(
463  'data' => 'file:current:name',
464  'wrap' => '<p>|</p>',
465  ),
466  ),
467  '<p>File 2</p>',
468  ),
469  'Multiple collections' => array(
470  array(
471  'collections' => '1,2,3',
472  'renderObj' => 'TEXT',
473  'renderObj.' => array(
474  'data' => 'file:current:name',
475  'wrap' => '<p>|</p>',
476  ),
477  ),
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>',
479  ),
480  'Multiple collections with begin' => array(
481  array(
482  'collections' => '1,2,3',
483  'begin' => '3',
484  'renderObj' => 'TEXT',
485  'renderObj.' => array(
486  'data' => 'file:current:name',
487  'wrap' => '<p>|</p>',
488  ),
489  ),
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>',
491  ),
492  'Multiple collections with negative begin' => array(
493  array(
494  'collections' => '1,2,3',
495  'begin' => '-3',
496  'renderObj' => 'TEXT',
497  'renderObj.' => array(
498  'data' => 'file:current:name',
499  'wrap' => '<p>|</p>',
500  ),
501  ),
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>',
503  ),
504  'Multiple collections with maxItems' => array(
505  array(
506  'collections' => '1,2,3',
507  'maxItems' => '5',
508  'renderObj' => 'TEXT',
509  'renderObj.' => array(
510  'data' => 'file:current:name',
511  'wrap' => '<p>|</p>',
512  ),
513  ),
514  '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p>',
515  ),
516  'Multiple collections with negative maxItems' => array(
517  array(
518  'collections' => '1,2,3',
519  'maxItems' => '-5',
520  'renderObj' => 'TEXT',
521  'renderObj.' => array(
522  'data' => 'file:current:name',
523  'wrap' => '<p>|</p>',
524  ),
525  ),
526  '',
527  ),
528  'Multiple collections with begin and maxItems' => array(
529  array(
530  'collections' => '1,2,3',
531  'begin' => '4',
532  'maxItems' => '3',
533  'renderObj' => 'TEXT',
534  'renderObj.' => array(
535  'data' => 'file:current:name',
536  'wrap' => '<p>|</p>',
537  ),
538  ),
539  '<p>File 5</p><p>File 6</p><p>File 7</p>',
540  ),
541  'Multiple collections unsorted' => array(
542  array(
543  'collections' => '1,3,2',
544  'renderObj' => 'TEXT',
545  'renderObj.' => array(
546  'data' => 'file:current:name',
547  'wrap' => '<p>|</p>',
548  ),
549  ),
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>',
551  ),
552  'Multiple collections sorted by name' => array(
553  array(
554  'collections' => '3,1,2',
555  'sorting' => 'name',
556  'renderObj' => 'TEXT',
557  'renderObj.' => array(
558  'data' => 'file:current:name',
559  'wrap' => '<p>|</p>',
560  ),
561  ),
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>',
563  ),
564  );
565  }
566 
571  public function renderReturnsFilesForCollections($configuration, $expected) {
572  $collectionMap = array();
573  $fileCount = 1;
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())
579  ->method('getName')
580  ->will($this->returnValue('File ' . $fileCount));
581  $fileReference->expects($this->any())
582  ->method('hasProperty')
583  ->with('name')
584  ->will($this->returnValue(TRUE));
585  $fileReference->expects($this->any())
586  ->method('getProperty')
587  ->with('name')
588  ->will($this->returnValue('File ' . $fileCount));
589 
590  $fileReferenceArray[] = $fileReference;
591  $fileCount++;
592  }
593 
594  $collection = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Collection\\StaticFileCollection', array(), array(), '', FALSE);
595  $collection->expects($this->any())
596  ->method('getItems')
597  ->will($this->returnValue($fileReferenceArray));
598 
599  $collectionMap[] = array($i, $collection);
600  }
601 
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);
607 
608  $this->assertSame($expected, $this->subject->render($configuration));
609  }
610 
615  return array(
616  'One folder' => array(
617  array(
618  'folders' => '1:myfolder/',
619  'renderObj' => 'TEXT',
620  'renderObj.' => array(
621  'data' => 'file:current:name',
622  'wrap' => '<p>|</p>',
623  ),
624  ),
625  '<p>File 1</p><p>File 2</p><p>File 3</p>',
626  ),
627  'One folder with begin' => array(
628  array(
629  'folders' => '1:myfolder/',
630  'begin' => '1',
631  'renderObj' => 'TEXT',
632  'renderObj.' => array(
633  'data' => 'file:current:name',
634  'wrap' => '<p>|</p>',
635  ),
636  ),
637  '<p>File 2</p><p>File 3</p>',
638  ),
639  'One folder with begin higher than allowed' => array(
640  array(
641  'folders' => '1:myfolder/',
642  'begin' => '3',
643  'renderObj' => 'TEXT',
644  'renderObj.' => array(
645  'data' => 'file:current:name',
646  'wrap' => '<p>|</p>',
647  ),
648  ),
649  '',
650  ),
651  'One folder with maxItems' => array(
652  array(
653  'folders' => '1:myfolder/',
654  'maxItems' => '2',
655  'renderObj' => 'TEXT',
656  'renderObj.' => array(
657  'data' => 'file:current:name',
658  'wrap' => '<p>|</p>',
659  ),
660  ),
661  '<p>File 1</p><p>File 2</p>',
662  ),
663  'One folder with maxItems higher than allowed' => array(
664  array(
665  'folders' => '1:myfolder/',
666  'maxItems' => '4',
667  'renderObj' => 'TEXT',
668  'renderObj.' => array(
669  'data' => 'file:current:name',
670  'wrap' => '<p>|</p>',
671  ),
672  ),
673  '<p>File 1</p><p>File 2</p><p>File 3</p>',
674  ),
675  'One folder with begin and maxItems' => array(
676  array(
677  'folders' => '1:myfolder/',
678  'begin' => '1',
679  'maxItems' => '1',
680  'renderObj' => 'TEXT',
681  'renderObj.' => array(
682  'data' => 'file:current:name',
683  'wrap' => '<p>|</p>',
684  ),
685  ),
686  '<p>File 2</p>',
687  ),
688  'Multiple folders' => array(
689  array(
690  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
691  'renderObj' => 'TEXT',
692  'renderObj.' => array(
693  'data' => 'file:current:name',
694  'wrap' => '<p>|</p>',
695  ),
696  ),
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>',
698  ),
699  'Multiple folders with begin' => array(
700  array(
701  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
702  'begin' => '3',
703  'renderObj' => 'TEXT',
704  'renderObj.' => array(
705  'data' => 'file:current:name',
706  'wrap' => '<p>|</p>',
707  ),
708  ),
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>',
710  ),
711  'Multiple folders with negative begin' => array(
712  array(
713  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
714  'begin' => '-3',
715  'renderObj' => 'TEXT',
716  'renderObj.' => array(
717  'data' => 'file:current:name',
718  'wrap' => '<p>|</p>',
719  ),
720  ),
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>',
722  ),
723  'Multiple folders with maxItems' => array(
724  array(
725  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
726  'maxItems' => '5',
727  'renderObj' => 'TEXT',
728  'renderObj.' => array(
729  'data' => 'file:current:name',
730  'wrap' => '<p>|</p>',
731  ),
732  ),
733  '<p>File 1</p><p>File 2</p><p>File 3</p><p>File 4</p><p>File 5</p>',
734  ),
735  'Multiple folders with negative maxItems' => array(
736  array(
737  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
738  'maxItems' => '-5',
739  'renderObj' => 'TEXT',
740  'renderObj.' => array(
741  'data' => 'file:current:name',
742  'wrap' => '<p>|</p>',
743  ),
744  ),
745  '',
746  ),
747  'Multiple folders with begin and maxItems' => array(
748  array(
749  'folders' => '1:myfolder/,2:myfolder/,3:myfolder/',
750  'begin' => '4',
751  'maxItems' => '3',
752  'renderObj' => 'TEXT',
753  'renderObj.' => array(
754  'data' => 'file:current:name',
755  'wrap' => '<p>|</p>',
756  ),
757  ),
758  '<p>File 5</p><p>File 6</p><p>File 7</p>',
759  ),
760  'Multiple folders unsorted' => array(
761  array(
762  'folders' => '1:myfolder/,3:myfolder/,2:myfolder/',
763  'renderObj' => 'TEXT',
764  'renderObj.' => array(
765  'data' => 'file:current:name',
766  'wrap' => '<p>|</p>',
767  ),
768  ),
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>',
770  ),
771  'Multiple folders sorted by name' => array(
772  array(
773  'folders' => '3:myfolder/,1:myfolder/,2:myfolder/',
774  'sorting' => 'name',
775  'renderObj' => 'TEXT',
776  'renderObj.' => array(
777  'data' => 'file:current:name',
778  'wrap' => '<p>|</p>',
779  ),
780  ),
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>',
782  ),
783  );
784  }
785 
790  public function renderReturnsFilesForFolders($configuration, $expected) {
791  $folderMap = array();
792  $fileCount = 1;
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())
798  ->method('getName')
799  ->will($this->returnValue('File ' . $fileCount));
800  $file->expects($this->any())
801  ->method('hasProperty')
802  ->with('name')
803  ->will($this->returnValue(TRUE));
804  $file->expects($this->any())
805  ->method('getProperty')
806  ->with('name')
807  ->will($this->returnValue('File ' . $fileCount));
808 
809  $fileArray[] = $file;
810  $fileCount++;
811  }
812 
813  $folder = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Folder', array(), array(), '', FALSE);
814  $folder->expects($this->any())
815  ->method('getFiles')
816  ->will($this->returnValue($fileArray));
817 
818  $folderMap[] = array($i . ':myfolder/', $folder);
819  }
820 
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);
826 
827  $this->assertSame($expected, $this->subject->render($configuration));
828  }
829 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]