14 include_once(__DIR__ .
'/Fixtures/TransparentSyntaxTreeNode.php');
15 include_once(__DIR__ .
'/Fixtures/TemplateViewFixture.php');
33 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPath',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
34 $templateView->_set(
'controllerContext', $mockControllerContext);
35 $templateView->expects($this->any())->method(
'getTemplateRootPath')->will($this->returnValue(
'Resources/Private/'));
37 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/@subpackage/@controller/@action.@format', FALSE, FALSE);
38 $this->assertEquals($expected, $actual);
48 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPath',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
49 $templateView->_set(
'controllerContext', $mockControllerContext);
50 $templateView->expects($this->any())->method(
'getTemplateRootPath')->will($this->returnValue(
'Resources/Private/'));
52 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/@subpackage/@controller/@action.@format', FALSE, FALSE);
53 $this->assertEquals($expected, $actual);
66 $controllerObjectName =
"TYPO3\\$packageKey\\" . ($subPackageKey != $subPackageKey .
'\\' ? :
'') .
'Controller\\' . $controllerName .
'Controller';
67 $mockRequest = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
68 $mockRequest->expects($this->any())->method(
'getControllerExtensionKey')->will($this->returnValue(
'frontend'));
69 $mockRequest->expects($this->any())->method(
'getControllerPackageKey')->will($this->returnValue($packageKey));
70 $mockRequest->expects($this->any())->method(
'getControllerSubPackageKey')->will($this->returnValue($subPackageKey));
71 $mockRequest->expects($this->any())->method(
'getControllerName')->will($this->returnValue($controllerName));
72 $mockRequest->expects($this->any())->method(
'getControllerObjectName')->will($this->returnValue($controllerObjectName));
73 $mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue($format));
75 $mockControllerContext = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(
'getRequest'), array(),
'', FALSE);
76 $mockControllerContext->expects($this->any())->method(
'getRequest')->will($this->returnValue($mockRequest));
78 return $mockControllerContext;
85 'package' =>
'Some.Package',
86 'subPackage' =>
'Some\\Sub\\Package',
87 'controller' =>
'SomeController',
89 'templateRootPath' =>
'Resources/Private/Templates',
90 'templateRootPaths' => NULL,
91 'partialRootPath' =>
'Resources/Private/Partials',
92 'partialRootPaths' => NULL,
93 'layoutRootPath' =>
'Resources/Private/Layouts',
94 'layoutRootPaths' => NULL,
95 'bubbleControllerAndSubpackage' => TRUE,
96 'formatIsOptional' => TRUE,
97 'pattern' =>
'@templateRoot/@subpackage/@controller/@action.@format',
98 'expectedResult' => array(
99 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action.html',
100 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action',
101 'Resources/Private/Templates/Some/Sub/Package/@action.html',
102 'Resources/Private/Templates/Some/Sub/Package/@action',
103 'Resources/Private/Templates/Sub/Package/@action.html',
104 'Resources/Private/Templates/Sub/Package/@action',
105 'Resources/Private/Templates/Package/@action.html',
106 'Resources/Private/Templates/Package/@action',
107 'Resources/Private/Templates/@action.html',
108 'Resources/Private/Templates/@action',
113 'package' =>
'Some.Package',
114 'subPackage' =>
'Some\\Sub\\Package',
115 'controller' =>
'SomeController',
117 'templateRootPath' =>
'Resources/Private/Templates/',
118 'templateRootPaths' => NULL,
119 'partialRootPath' =>
'Resources/Private/Partials',
120 'partialRootPaths' => NULL,
121 'layoutRootPath' =>
'Resources/Private/Layouts',
122 'layoutRootPaths' => NULL,
123 'bubbleControllerAndSubpackage' => FALSE,
124 'formatIsOptional' => TRUE,
125 'pattern' =>
'@templateRoot/@subpackage/@controller/@action.@format',
126 'expectedResult' => array(
127 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action.html',
128 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action',
133 'package' =>
'Some.Package',
134 'subPackage' =>
'Some\\Sub\\Package',
135 'controller' =>
'SomeController',
137 'templateRootPath' =>
'Resources/Private/Templates',
138 'templateRootPaths' => NULL,
139 'partialRootPath' =>
'Resources/Private/Partials',
140 'partialRootPaths' => NULL,
141 'layoutRootPath' =>
'Resources/Private/Layouts',
142 'layoutRootPaths' => NULL,
143 'bubbleControllerAndSubpackage' => TRUE,
144 'formatIsOptional' => FALSE,
145 'pattern' =>
'@partialRoot/@subpackage/@controller/@action.@format',
146 'expectedResult' => array(
147 'Resources/Private/Partials/Some/Sub/Package/SomeController/@action.json',
148 'Resources/Private/Partials/Some/Sub/Package/@action.json',
149 'Resources/Private/Partials/Sub/Package/@action.json',
150 'Resources/Private/Partials/Package/@action.json',
151 'Resources/Private/Partials/@action.json',
156 'package' =>
'Some.Package',
157 'subPackage' => NULL,
158 'controller' => NULL,
160 'templateRootPath' =>
'Resources/Private/Templates',
161 'templateRootPaths' => NULL,
162 'partialRootPath' =>
'Resources/Private/Partials',
163 'partialRootPaths' => NULL,
164 'layoutRootPath' =>
'Resources/Private/Layouts',
165 'layoutRootPaths' => NULL,
166 'bubbleControllerAndSubpackage' => TRUE,
167 'formatIsOptional' => TRUE,
168 'pattern' =>
'@layoutRoot/@subpackage/@controller/@action.@format',
169 'expectedResult' => array(
170 'Resources/Private/Layouts/@action.xml',
171 'Resources/Private/Layouts/@action',
176 'package' =>
'Some.Package',
177 'subPackage' =>
'Some\\Sub\\Package',
178 'controller' => NULL,
180 'templateRootPath' =>
'Resources/Private/Templates',
181 'templateRootPaths' => NULL,
182 'partialRootPath' =>
'Resources/Private/Partials',
183 'partialRootPaths' => NULL,
184 'layoutRootPath' =>
'Resources/Private/Layouts',
185 'layoutRootPaths' => NULL,
186 'bubbleControllerAndSubpackage' => TRUE,
187 'formatIsOptional' => TRUE,
188 'pattern' =>
'@templateRoot/@subpackage/@controller/@action.@format',
189 'expectedResult' => array(
190 'Resources/Private/Templates/Some/Sub/Package/@action.html',
191 'Resources/Private/Templates/Some/Sub/Package/@action',
192 'Resources/Private/Templates/Sub/Package/@action.html',
193 'Resources/Private/Templates/Sub/Package/@action',
194 'Resources/Private/Templates/Package/@action.html',
195 'Resources/Private/Templates/Package/@action',
196 'Resources/Private/Templates/@action.html',
197 'Resources/Private/Templates/@action',
202 'package' =>
'Some.Package',
203 'subPackage' =>
'Some\\Sub\\Package',
204 'controller' =>
'SomeController',
206 'templateRootPath' =>
'Resources/Private/Templates_@format',
207 'templateRootPaths' => NULL,
208 'partialRootPath' =>
'Resources/Private/Partials',
209 'partialRootPaths' => NULL,
210 'layoutRootPath' =>
'Resources/Private/Layouts',
211 'layoutRootPaths' => NULL,
212 'bubbleControllerAndSubpackage' => FALSE,
213 'formatIsOptional' => TRUE,
214 'pattern' =>
'@templateRoot/@subpackage/@controller/@action',
215 'expectedResult' => array(
216 'Resources/Private/Templates_xml/Some/Sub/Package/SomeController/@action',
217 'Resources/Private/Templates_/Some/Sub/Package/SomeController/@action',
222 'package' =>
'Some.Package',
223 'subPackage' =>
'Some\\Sub\\Package',
224 'controller' =>
'SomeController',
226 'templateRootPath' =>
'Resources/Private/Templates_@format',
227 'templateRootPaths' => NULL,
228 'partialRootPath' =>
'Resources/Private/Partials',
229 'partialRootPaths' => NULL,
230 'layoutRootPath' =>
'Resources/Private/Layouts',
231 'layoutRootPaths' => NULL,
232 'bubbleControllerAndSubpackage' => FALSE,
233 'formatIsOptional' => FALSE,
234 'pattern' =>
'@templateRoot/@subpackage/@controller/@action',
235 'expectedResult' => array(
236 'Resources/Private/Templates_json/Some/Sub/Package/SomeController/@action',
241 'package' =>
'Some.Package',
242 'subPackage' => NULL,
243 'controller' =>
'SomeController',
245 'templateRootPath' =>
'Resources/Private/Templates',
246 'templateRootPaths' => NULL,
247 'partialRootPath' =>
'Resources/Private/Partials',
248 'partialRootPaths' => NULL,
249 'layoutRootPath' =>
'Some/Root/Path/',
250 'layoutRootPaths' => NULL,
251 'bubbleControllerAndSubpackage' => TRUE,
252 'formatIsOptional' => TRUE,
253 'pattern' =>
'@layoutRoot/@subpackage/@controller/@action.@format',
254 'expectedResult' => array(
255 'Some/Root/Path/SomeController/@action.html',
256 'Some/Root/Path/SomeController/@action',
257 'Some/Root/Path/@action.html',
258 'Some/Root/Path/@action',
263 'package' =>
'Some.Package',
264 'subPackage' =>
'Some\\Sub\\Package',
265 'controller' =>
'SomeController',
267 'templateRootPath' =>
'Resources/Private/Templates',
268 'templateRootPaths' => NULL,
269 'partialRootPath' =>
'Resources/Private/Partials',
270 'partialRootPaths' => NULL,
271 'layoutRootPath' =>
'Resources/Private/Layouts',
272 'layoutRootPaths' => NULL,
273 'bubbleControllerAndSubpackage' => TRUE,
274 'formatIsOptional' => FALSE,
276 'expectedResult' => array(
282 'package' =>
'Some.Package',
283 'subPackage' =>
'Some\\Sub\\Package',
284 'controller' =>
'SomeController',
286 'templateRootPath' =>
'Resources/Private/Templates',
287 'templateRootPaths' => array(
'Resources/Private/Templates',
'Some/Fallback/Path'),
288 'partialRootPath' =>
'Resources/Private/Partials',
289 'partialRootPaths' => NULL,
290 'layoutRootPath' =>
'Resources/Private/Layouts',
291 'layoutRootPaths' => NULL,
292 'bubbleControllerAndSubpackage' => FALSE,
293 'formatIsOptional' => TRUE,
294 'pattern' =>
'@templateRoot/@subpackage/@controller/@action.@format',
295 'expectedResult' => array(
296 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action.html',
297 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action',
298 'Some/Fallback/Path/Some/Sub/Package/SomeController/@action.html',
299 'Some/Fallback/Path/Some/Sub/Package/SomeController/@action',
304 'package' =>
'Some.Package',
305 'subPackage' =>
'Some\\Sub\\Package',
306 'controller' =>
'SomeController',
308 'templateRootPath' =>
'Resources/Private/Templates',
309 'templateRootPaths' => array(
'Resources/Private/Templates',
'Some/Fallback/Path'),
310 'partialRootPath' =>
'Resources/Private/Partials',
311 'partialRootPaths' => NULL,
312 'layoutRootPath' =>
'Resources/Private/Layouts',
313 'layoutRootPaths' => NULL,
314 'bubbleControllerAndSubpackage' => TRUE,
315 'formatIsOptional' => FALSE,
316 'pattern' =>
'@templateRoot/@subpackage/@controller/@action.@format',
317 'expectedResult' => array(
318 'Resources/Private/Templates/Some/Sub/Package/SomeController/@action.html',
319 'Resources/Private/Templates/Some/Sub/Package/@action.html',
320 'Resources/Private/Templates/Sub/Package/@action.html',
321 'Resources/Private/Templates/Package/@action.html',
322 'Resources/Private/Templates/@action.html',
323 'Some/Fallback/Path/Some/Sub/Package/SomeController/@action.html',
324 'Some/Fallback/Path/Some/Sub/Package/@action.html',
325 'Some/Fallback/Path/Sub/Package/@action.html',
326 'Some/Fallback/Path/Package/@action.html',
327 'Some/Fallback/Path/@action.html',
332 'package' =>
'Some.Package',
333 'subPackage' =>
'Some\\Sub\\Package',
334 'controller' =>
'SomeController',
336 'templateRootPath' =>
'Resources/Private/Templates',
337 'templateRootPaths' => NULL,
338 'partialRootPath' =>
'Resources/Private/Partials',
339 'partialRootPaths' => array(
'Default/Resources/Path',
'Fallback/'),
340 'layoutRootPath' =>
'Resources/Private/Layouts',
341 'layoutRootPaths' => NULL,
342 'bubbleControllerAndSubpackage' => FALSE,
343 'formatIsOptional' => TRUE,
344 'pattern' =>
'@partialRoot/@subpackage/@controller/@partial.@format',
345 'expectedResult' => array(
346 'Default/Resources/Path/Some/Sub/Package/SomeController/@partial.html',
347 'Default/Resources/Path/Some/Sub/Package/SomeController/@partial',
348 'Fallback/Some/Sub/Package/SomeController/@partial.html',
349 'Fallback/Some/Sub/Package/SomeController/@partial',
354 'package' =>
'Some.Package',
355 'subPackage' =>
'Some\\Sub\\Package',
356 'controller' =>
'SomeController',
358 'templateRootPath' =>
'Resources/Private/Templates',
359 'templateRootPaths' => array(
'Resources/Private/Templates',
'Some/Fallback/Path'),
360 'partialRootPath' =>
'Resources/Private/Partials',
361 'partialRootPaths' => array(
'Default/Resources/Path',
'Fallback1/',
'Fallback2'),
362 'layoutRootPath' =>
'Resources/Private/Layouts',
363 'layoutRootPaths' => NULL,
364 'bubbleControllerAndSubpackage' => TRUE,
365 'formatIsOptional' => TRUE,
366 'pattern' =>
'@partialRoot/@controller/@subpackage/@partial',
367 'expectedResult' => array(
368 'Default/Resources/Path/SomeController/Some/Sub/Package/@partial',
369 'Default/Resources/Path/Some/Sub/Package/@partial',
370 'Default/Resources/Path/Sub/Package/@partial',
371 'Default/Resources/Path/Package/@partial',
372 'Default/Resources/Path/@partial',
373 'Fallback1/SomeController/Some/Sub/Package/@partial',
374 'Fallback1/Some/Sub/Package/@partial',
375 'Fallback1/Sub/Package/@partial',
376 'Fallback1/Package/@partial',
377 'Fallback1/@partial',
378 'Fallback2/SomeController/Some/Sub/Package/@partial',
379 'Fallback2/Some/Sub/Package/@partial',
380 'Fallback2/Sub/Package/@partial',
381 'Fallback2/Package/@partial',
382 'Fallback2/@partial',
387 'package' =>
'Some.Package',
388 'subPackage' =>
'Some\\Sub\\Package',
389 'controller' =>
'SomeController',
391 'templateRootPath' =>
'Resources/Private/Templates',
392 'templateRootPaths' => array(
'Resources/Private/Templates',
'Some/Fallback/Path'),
393 'partialRootPath' =>
'Resources/Private/Partials',
394 'partialRootPaths' => array(
'foo',
'bar'),
395 'layoutRootPath' =>
'Resources/Private/Layouts',
396 'layoutRootPaths' => array(
'Default/Layout/Path',
'Fallback/Path'),
397 'bubbleControllerAndSubpackage' => FALSE,
398 'formatIsOptional' => FALSE,
399 'pattern' =>
'@layoutRoot/@subpackage/@controller/@layout.@format',
400 'expectedResult' => array(
401 'Default/Layout/Path/Some/Sub/Package/SomeController/@layout.html',
402 'Fallback/Path/Some/Sub/Package/SomeController/@layout.html',
407 'package' =>
'Some.Package',
408 'subPackage' =>
'Some\\Sub\\Package',
409 'controller' =>
'SomeController',
411 'templateRootPath' =>
'Resources/Private/Templates',
412 'templateRootPaths' => NULL,
413 'partialRootPath' =>
'Resources/Private/Partials',
414 'partialRootPaths' => NULL,
415 'layoutRootPath' =>
'Resources/Private/Layouts',
416 'layoutRootPaths' => array(
'Resources/Layouts',
'Some/Fallback/Path'),
417 'bubbleControllerAndSubpackage' => TRUE,
418 'formatIsOptional' => TRUE,
419 'pattern' =>
'Static/@layoutRoot/@subpackage/@controller/@layout.@format',
420 'expectedResult' => array(
421 'Static/Resources/Layouts/Some/Sub/Package/SomeController/@layout.html',
422 'Static/Resources/Layouts/Some/Sub/Package/SomeController/@layout',
423 'Static/Resources/Layouts/Some/Sub/Package/@layout.html',
424 'Static/Resources/Layouts/Some/Sub/Package/@layout',
425 'Static/Resources/Layouts/Sub/Package/@layout.html',
426 'Static/Resources/Layouts/Sub/Package/@layout',
427 'Static/Resources/Layouts/Package/@layout.html',
428 'Static/Resources/Layouts/Package/@layout',
429 'Static/Resources/Layouts/@layout.html',
430 'Static/Resources/Layouts/@layout',
431 'Static/Some/Fallback/Path/Some/Sub/Package/SomeController/@layout.html',
432 'Static/Some/Fallback/Path/Some/Sub/Package/SomeController/@layout',
433 'Static/Some/Fallback/Path/Some/Sub/Package/@layout.html',
434 'Static/Some/Fallback/Path/Some/Sub/Package/@layout',
435 'Static/Some/Fallback/Path/Sub/Package/@layout.html',
436 'Static/Some/Fallback/Path/Sub/Package/@layout',
437 'Static/Some/Fallback/Path/Package/@layout.html',
438 'Static/Some/Fallback/Path/Package/@layout',
439 'Static/Some/Fallback/Path/@layout.html',
440 'Static/Some/Fallback/Path/@layout',
445 'package' =>
'Some.Package',
446 'subPackage' =>
'Some\\Sub\\Package',
447 'controller' =>
'SomeController',
449 'templateRootPath' =>
'Resources/Private/Templates',
450 'templateRootPaths' => array(
'Resources/Templates',
'Templates/Fallback1',
'Templates/Fallback2'),
451 'partialRootPath' =>
'Resources/Private/Partials',
452 'partialRootPaths' => array(
'Resources/Partials'),
453 'layoutRootPath' =>
'Resources/Private/Layouts',
454 'layoutRootPaths' => array(
'Resources/Layouts',
'Layouts/Fallback1'),
455 'bubbleControllerAndSubpackage' => FALSE,
456 'formatIsOptional' => TRUE,
457 'pattern' =>
'@layoutRoot/@templateRoot/@partialRoot/@subpackage/@controller/foo',
458 'expectedResult' => array(
459 'Resources/Layouts/Resources/Templates/Resources/Partials/Some/Sub/Package/SomeController/foo',
460 'Layouts/Fallback1/Resources/Templates/Resources/Partials/Some/Sub/Package/SomeController/foo',
461 'Resources/Layouts/Templates/Fallback1/Resources/Partials/Some/Sub/Package/SomeController/foo',
462 'Layouts/Fallback1/Templates/Fallback1/Resources/Partials/Some/Sub/Package/SomeController/foo',
463 'Resources/Layouts/Templates/Fallback2/Resources/Partials/Some/Sub/Package/SomeController/foo',
464 'Layouts/Fallback1/Templates/Fallback2/Resources/Partials/Some/Sub/Package/SomeController/foo',
489 public function expandGenericPathPatternTests($package, $subPackage, $controller, $format, $templateRootPath, array $templateRootPaths = NULL, $partialRootPath, array $partialRootPaths = NULL, $layoutRootPath, array $layoutRootPaths = NULL, $bubbleControllerAndSubpackage, $formatIsOptional, $pattern, $expectedResult) {
493 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
494 $templateView->setControllerContext($mockControllerContext);
495 if ($templateRootPath !== NULL) {
496 $templateView->setTemplateRootPath($templateRootPath);
498 if ($templateRootPaths !== NULL) {
499 $templateView->setTemplateRootPaths($templateRootPaths);
502 if ($partialRootPath !== NULL) {
503 $templateView->setPartialRootPath($partialRootPath);
505 if ($partialRootPaths !== NULL) {
506 $templateView->setPartialRootPaths($partialRootPaths);
509 if ($layoutRootPath !== NULL) {
510 $templateView->setLayoutRootPath($layoutRootPath);
512 if ($layoutRootPaths !== NULL) {
513 $templateView->setLayoutRootPaths($layoutRootPaths);
516 $actualResult = $templateView->_call(
'expandGenericPathPattern', $pattern, $bubbleControllerAndSubpackage, $formatIsOptional);
517 $this->assertEquals($expectedResult, $actualResult);
526 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPaths',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
527 $templateView->_set(
'controllerContext', $mockControllerContext);
528 $templateView->expects($this->any())->method(
'getTemplateRootPaths')->will($this->returnValue(array(
'Resources/Private/')));
530 $expected = array(
'Resources/Private/Templates/My/@action.html');
531 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, FALSE);
532 $this->assertEquals($expected, $actual);
542 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPaths',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
543 $templateView->_set(
'controllerContext', $mockControllerContext);
544 $templateView->expects($this->any())->method(
'getTemplateRootPaths')->will($this->returnValue(array(
'Resources/Private/')));
545 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, FALSE);
548 'Resources/Private/Templates/MySubPackage/My/@action.html' 550 $this->assertEquals($expected, $actual);
559 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPaths',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
560 $templateView->_set(
'controllerContext', $mockControllerContext);
561 $templateView->expects($this->any())->method(
'getTemplateRootPaths')->will($this->returnValue(array(
'Resources/Private/')));
562 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/Templates/@subpackage/@controller/@action.@format', FALSE, TRUE);
565 'Resources/Private/Templates/MySubPackage/My/@action.html',
566 'Resources/Private/Templates/MySubPackage/My/@action' 568 $this->assertEquals($expected, $actual);
577 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'getTemplateRootPaths',
'getPartialRootPath',
'getLayoutRootPath'), array(),
'', FALSE);
578 $templateView->_set(
'controllerContext', $mockControllerContext);
579 $templateView->expects($this->any())->method(
'getTemplateRootPaths')->will($this->returnValue(array(
'Resources/Private/')));
580 $actual = $templateView->_call(
'expandGenericPathPattern',
'@templateRoot/Templates/@subpackage/@controller/@action.@format', TRUE, TRUE);
583 'Resources/Private/Templates/MySubPackage/My/@action.html',
584 'Resources/Private/Templates/MySubPackage/My/@action',
585 'Resources/Private/Templates/MySubPackage/@action.html',
586 'Resources/Private/Templates/MySubPackage/@action',
587 'Resources/Private/Templates/@action.html',
588 'Resources/Private/Templates/@action' 590 $this->assertEquals($expected, $actual);
597 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
598 $templateView->setTemplateRootPath(
'/foo/bar');
599 $expected = array(
'/foo/bar');
600 $actual = $templateView->_call(
'getTemplateRootPaths');
601 $this->assertEquals($expected, $actual,
'A set template root path was not returned correctly.');
608 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
609 $templateView->setTemplateRootPath(
'/foo/bar');
610 $templateView->setTemplateRootPaths(array(
'/overruled/path'));
611 $expected = array(
'/overruled/path');
612 $actual = $templateView->_call(
'getTemplateRootPaths');
613 $this->assertEquals($expected, $actual,
'A set template root path was not returned correctly.');
620 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
621 $templateView->setPartialRootPath(
'/foo/bar');
622 $expected = array(
'/foo/bar');
623 $actual = $templateView->_call(
'getPartialRootPaths');
624 $this->assertEquals($expected, $actual,
'A set partial root path was not returned correctly.');
631 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
632 $templateView->setLayoutRootPath(
'/foo/bar');
633 $expected = array(
'/foo/bar');
634 $actual = $templateView->_call(
'getLayoutRootPaths');
635 $this->assertEquals($expected, $actual,
'A set partial root path was not returned correctly.');
642 vfsStreamWrapper::register();
643 mkdir(
'vfs://MyPartials');
644 \file_put_contents(
'vfs://MyPartials/SomePartial',
'contentsOfSomePartial');
647 'vfs://NonExistantDir/UnknowFile.html',
648 'vfs://MyPartials/SomePartial.html',
649 'vfs://MyPartials/SomePartial' 652 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'expandGenericPathPattern',
'resolveFileNamePath'), array(),
'', FALSE);
653 $templateView->expects($this->once())->method(
'expandGenericPathPattern')->with(
'@partialRoot/@subpackage/@partial.@format', TRUE, TRUE)->will($this->returnValue($paths));
654 $templateView->expects($this->any())->method(
'resolveFileNamePath')->will($this->onConsecutiveCalls(
660 $templateView->setTemplateRootPath(
'MyTemplates');
661 $templateView->setPartialRootPath(
'MyPartials');
662 $templateView->setLayoutRootPath(
'MyLayouts');
664 $this->assertSame(
'contentsOfSomePartial', $templateView->_call(
'getPartialSource',
'SomePartial'));
671 vfsStreamWrapper::register();
672 mkdir(
'vfs://MyTemplates');
673 \file_put_contents(
'vfs://MyTemplates/MyCoolAction.html',
'contentsOfMyCoolAction');
676 'vfs://NonExistantDir/UnknownFile.html',
677 'vfs://MyTemplates/@action.html' 680 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'expandGenericPathPattern',
'resolveFileNamePath'), array(),
'', FALSE);
681 $templateView->expects($this->once())->method(
'expandGenericPathPattern')->with(
'@templateRoot/@subpackage/@controller/@action.@format', FALSE, FALSE)->will($this->returnValue($paths));
682 $templateView->expects($this->any())->method(
'resolveFileNamePath')->will($this->onConsecutiveCalls(
684 'vfs://MyTemplates/MyCoolAction.html' 687 $templateView->setTemplateRootPath(
'MyTemplates');
688 $templateView->setPartialRootPath(
'MyPartials');
689 $templateView->setLayoutRootPath(
'MyLayouts');
691 $this->assertSame(
'contentsOfMyCoolAction', $templateView->_call(
'getTemplateSource',
'myCoolAction'));
699 vfsStreamWrapper::register();
700 mkdir(
'vfs://MyTemplates');
701 \file_put_contents(
'vfs://MyTemplates/MyCoolAction.html',
'contentsOfMyCoolAction');
703 $templateView = $this->
getAccessibleMock(
'TYPO3\\CMS\\Fluid\\View\\TemplateView', array(
'dummy'), array(),
'', FALSE);
704 $templateView->_set(
'templatePathAndFilename',
'vfs://MyTemplates/MyCoolAction.html');
706 $this->assertSame(
'contentsOfMyCoolAction', $templateView->_call(
'getTemplateSource'));
setupMockControllerContextForPathResolving($packageKey, $subPackageKey, $controllerName, $format)
expandGenericPathPatternDataProvider()
static extPath($key, $script='')
getPartialRootPathsReturnsUserSpecifiedPartialPath()
getLayoutRootPathsReturnsUserSpecifiedPartialPath()
getTemplateRootPathsReturnsUserSpecifiedTemplatePaths()
expandGenericPathPatternWorksWithSubpackageAndBubblingDisabledAndFormatNotOptional()
expandGenericPathPatternWorksWithOldNamingSchemeOfSubPackage()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
resolveTemplatePathAndFilenameChecksDifferentPathPatternsAndReturnsTheFirstPathWhichExists()
expandGenericPathPatternWorksWithBubblingDisabledAndFormatNotOptional()
pathToPartialIsResolvedCorrectly()
setTemplateRootPathOverrulesSetTemplateRootPaths()
resolveTemplatePathAndFilenameReturnsTheExplicitlyConfiguredTemplatePathAndFilename()
expandGenericPathPatternWorksWithSubpackageAndBubblingDisabledAndFormatOptional()
expandGenericPathPatternWorksWithSubpackageAndBubblingEnabledAndFormatOptional()
expandGenericPathPatternWorksWithNewNamingSchemeOfSubPackage()