2 namespace TYPO3\CMS\Fluid\Tests\Unit\View;
24 use TYPO3\CMS\Core\Tests\UnitTestCase;
113 $this->view = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\View\StandaloneView::class, array(
'testFileExistence',
'buildParserConfiguration'), array(),
'',
false);
114 $this->mockTemplateParser = $this->getMock(TemplateParser::class);
115 $this->mockParsedTemplate = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsedTemplateInterface::class);
116 $this->mockTemplateParser->expects($this->any())->method(
'parse')->will($this->returnValue($this->mockParsedTemplate));
117 $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class);
118 $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
119 $this->mockObjectManager->expects($this->any())->method(
'get')->will($this->returnCallback(array($this,
'objectManagerCallback')));
120 $this->mockRequest = $this->getMock(Request::class);
121 $this->mockUriBuilder = $this->getMock(UriBuilder::class);
122 $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
123 $this->mockControllerContext = $this->getMock(ControllerContext::class);
124 $this->mockControllerContext->expects($this->any())->method(
'getRequest')->will($this->returnValue($this->mockRequest));
125 $this->mockViewHelperVariableContainer = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
126 $this->mockRenderingContext = $this->getMock(RenderingContext::class);
127 $this->mockRenderingContext->expects($this->any())->method(
'getControllerContext')->will($this->returnValue($this->mockControllerContext));
128 $this->mockRenderingContext->expects($this->any())->method(
'getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
129 $this->view->_set(
'templateParser', $this->mockTemplateParser);
130 $this->view->_set(
'objectManager', $this->mockObjectManager);
131 $this->view->setRenderingContext($this->mockRenderingContext);
132 $this->mockTemplateCompiler = $this->getMock(TemplateCompiler::class);
133 $this->view->_set(
'templateCompiler', $this->mockTemplateCompiler);
137 $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(),
'',
false);
138 $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(),
'',
false);
139 $mockCacheManager->expects($this->any())->method(
'getCache')->will($this->returnValue($mockCache));
159 switch ($className) {
160 case ConfigurationManagerInterface::class:
162 case TemplateParser::class:
164 case RenderingContext::class:
168 case UriBuilder::class:
170 case ControllerContext::class:
172 case TemplateCompiler::class:
175 throw new \InvalidArgumentException(
'objectManagerCallback cannot handle class "' . $className .
'". Looks like incomplete mocking in the tests.', 1417105493);
183 $mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
184 $this->mockConfigurationManager->expects($this->once())->method(
'setContentObject')->with($this->identicalTo(
$mockContentObject));
193 $this->mockConfigurationManager->expects($this->once())->method(
'setContentObject')->with($this->identicalTo($this->mockContentObject));
203 $this->mockRequest->expects($this->once())->method(
'setRequestURI')->with($expectedRequestUri);
213 $this->mockRequest->expects($this->once())->method(
'setBaseURI')->with($expectedBaseUri);
222 $this->mockUriBuilder->expects($this->once())->method(
'setRequest')->with($this->mockRequest);
231 $this->mockControllerContext->expects($this->once())->method(
'setRequest')->with($this->mockRequest);
240 $this->mockControllerContext->expects($this->once())->method(
'setUriBuilder')->with($this->mockUriBuilder);
250 $this->view->render();
258 $this->view->setTemplateSource(
'The Template Source');
259 $this->mockTemplateParser->expects($this->once())->method(
'parse')->with(
'The Template Source');
260 $this->view->render();
269 $expectedResult = file_get_contents($templatePathAndFilename);
270 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
271 $this->view->expects($this->once())->method(
'testFileExistence')->with($templatePathAndFilename)->will($this->returnValue(
true));
272 $this->mockTemplateParser->expects($this->once())->method(
'parse')->with($expectedResult);
273 $this->view->render();
282 $this->view->setTemplatePathAndFilename(
'NonExistingTemplatePath');
283 @$this->view->render();
291 $this->mockRequest->expects($this->once())->method(
'setFormat')->with(
'xml');
292 $this->view->setFormat(
'xml');
301 $this->view->getLayoutRootPath();
310 $this->view->getLayoutRootPaths();
318 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
319 $layoutRootPath =
'some/layout/RootPath';
320 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
321 $this->view->setLayoutRootPath($layoutRootPath);
322 $actualResult = $this->view->getLayoutRootPath();
323 $this->assertEquals($layoutRootPath, $actualResult);
331 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
332 $layoutRootPaths = array(
333 'some/layout/RootPath'
335 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
336 $this->view->setLayoutRootPaths($layoutRootPaths);
337 $actualResult = $this->view->getLayoutRootPaths();
338 $this->assertEquals($layoutRootPaths, $actualResult);
346 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
347 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
348 $expectedResult =
'some/template/RootPath/Layouts';
349 $actualResult = $this->view->getLayoutRootPath();
350 $this->assertEquals($expectedResult, $actualResult);
358 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
359 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
360 $expectedResult = array(
'some/template/RootPath/Layouts');
361 $actualResult = $this->view->getLayoutRootPaths();
362 $this->assertEquals($expectedResult, $actualResult);
371 $this->view->setLayoutRootPath(
'some/non/existing/Path');
372 $this->view->_call(
'getLayoutSource');
381 $this->view->setLayoutRootPaths(array(
'some/non/existing/Path'));
382 $this->view->_call(
'getLayoutSource');
391 $layoutRootPath = __DIR__ .
'/Fixtures';
392 $this->view->setLayoutRootPaths(array($layoutRootPath));
393 $this->view->_call(
'getLayoutSource',
'NonExistingLayout');
402 $this->view->setLayoutRootPath($layoutRootPath);
403 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'html'));
404 $this->view->expects($this->once())->method(
'testFileExistence')->with($layoutRootPath .
'/LayoutFixture.html')->will($this->returnValue(
true));
405 $expectedResult = file_get_contents($layoutRootPath .
'/LayoutFixture.html');
406 $actualResult = $this->view->_call(
'getLayoutSource',
'LayoutFixture');
407 $this->assertEquals($expectedResult, $actualResult);
416 $this->view->setLayoutRootPath($layoutRootPath);
417 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'xml'));
418 $this->view->expects($this->once())->method(
'testFileExistence')->with($layoutRootPath .
'/LayoutFixture.xml')->will($this->returnValue(
true));
419 $expectedResult = file_get_contents($layoutRootPath .
'/LayoutFixture.xml');
420 $actualResult = $this->view->_call(
'getLayoutSource',
'LayoutFixture');
421 $this->assertEquals($expectedResult, $actualResult);
430 $this->view->setLayoutRootPath($layoutRootPath);
431 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'foo'));
432 $this->view->expects($this->at(0))->method(
'testFileExistence')->with($layoutRootPath .
'/LayoutFixture.foo')->will($this->returnValue(
false));
433 $this->view->expects($this->at(1))->method(
'testFileExistence')->with($layoutRootPath .
'/LayoutFixture')->will($this->returnValue(
true));
434 $expectedResult = file_get_contents($layoutRootPath .
'/LayoutFixture');
435 $actualResult = $this->view->_call(
'getLayoutSource',
'LayoutFixture');
436 $this->assertEquals($expectedResult, $actualResult);
445 $this->view->getPartialRootPath();
453 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
454 $partialRootPath =
'some/partial/RootPath';
455 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
456 $this->view->setPartialRootPath($partialRootPath);
457 $actualResult = $this->view->getPartialRootPath();
458 $this->assertEquals($partialRootPath, $actualResult);
466 $templatePathAndFilename =
'some/template/RootPath/SomeTemplate.html';
467 $this->view->setTemplatePathAndFilename($templatePathAndFilename);
468 $expectedResult =
'some/template/RootPath/Partials';
469 $actualResult = $this->view->getPartialRootPath();
470 $this->assertEquals($expectedResult, $actualResult);
479 $this->view->setPartialRootPath(
'some/non/existing/Path');
480 $this->view->_call(
'getPartialSource',
'SomePartial');
489 $partialRootPath = __DIR__ .
'/Fixtures';
490 $this->view->setPartialRootPath($partialRootPath);
491 $this->view->_call(
'getPartialSource',
'NonExistingPartial');
499 $partialRootPath = __DIR__ .
'/Fixtures';
500 $this->view->setPartialRootPath($partialRootPath);
501 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'html'));
502 $this->view->expects($this->once())->method(
'testFileExistence')->will($this->returnValue(
true));
503 $expectedResult = file_get_contents($partialRootPath .
'/LayoutFixture.html');
504 $actualResult = $this->view->_call(
'getPartialSource',
'LayoutFixture');
505 $this->assertEquals($expectedResult, $actualResult);
513 $partialRootPath = __DIR__ .
'/Fixtures';
514 $this->view->setPartialRootPath($partialRootPath);
515 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'xml'));
516 $this->view->expects($this->once())->method(
'testFileExistence')->will($this->returnValue(
true));
517 $expectedResult = file_get_contents($partialRootPath .
'/LayoutFixture.xml');
518 $actualResult = $this->view->_call(
'getPartialSource',
'LayoutFixture');
519 $this->assertEquals($expectedResult, $actualResult);
527 $partialRootPath = __DIR__ .
'/Fixtures';
528 $this->view->setPartialRootPath($partialRootPath);
529 $this->mockRequest->expects($this->once())->method(
'getFormat')->will($this->returnValue(
'foo'));
530 $this->view->expects($this->at(1))->method(
'testFileExistence')->will($this->returnValue(
true));
531 $expectedResult = file_get_contents($partialRootPath .
'/LayoutFixture');
532 $actualResult = $this->view->_call(
'getPartialSource',
'LayoutFixture');
533 $this->assertEquals($expectedResult, $actualResult);
541 $this->view->setPartialRootPath(
'/foo/bar');
542 $this->view->setPartialRootPaths(array(
'/overruled/path'));
543 $expected = array(
'/overruled/path');
544 $actual = $this->view->_call(
'getPartialRootPaths');
545 $this->assertEquals($expected, $actual,
'A set partial root path was not returned correctly.');
553 $this->view->setLayoutRootPath(
'/foo/bar');
554 $this->view->setLayoutRootPaths(array(
'/overruled/path'));
555 $expected = array(
'/overruled/path');
556 $actual = $this->view->_call(
'getLayoutRootPaths');
557 $this->assertEquals($expected, $actual,
'A set layout root path was not returned correctly.');
565 $this->view->setLayoutRootPaths(array(
'some/Default/Directory'));
566 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
567 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/LayoutName.html')->willReturn(
false);
568 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/LayoutName')->willReturn(
false);
569 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/layoutName.html')->willReturn(
true);
570 $this->assertSame(PATH_site .
'some/Default/Directory/layoutName.html', $this->view->_call(
'getLayoutPathAndFilename',
'layoutName'));
578 $this->view->setLayoutRootPaths(array(
'some/Default/Directory'));
579 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
580 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/LayoutName.html')->willReturn(
true);
581 $this->assertSame(PATH_site .
'some/Default/Directory/LayoutName.html', $this->view->_call(
'getLayoutPathAndFilename',
'layoutName'));
589 $this->view->setLayoutRootPaths(array(
590 'default' =>
'some/Default/Directory',
591 'specific' =>
'specific/Layouts',
593 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
594 $this->view->expects($this->once())->method(
'testFileExistence')->with(PATH_site .
'specific/Layouts/Default.html')->will($this->returnValue(
true));
595 $this->assertEquals(PATH_site .
'specific/Layouts/Default.html', $this->view->_call(
'getLayoutPathAndFilename'));
603 $this->view->setLayoutRootPaths(array(
604 'default' =>
'some/Default/Directory',
605 'specific' =>
'specific/Layouts',
607 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
608 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default.html')->will($this->returnValue(
true));
609 $this->assertEquals(PATH_site .
'some/Default/Directory/Default.html', $this->view->_call(
'getLayoutPathAndFilename'));
617 $this->view->setLayoutRootPaths(array(
618 '10' =>
'some/Default/Directory',
619 '25' =>
'evenMore/Specific/Layouts',
620 '17' =>
'specific/Layouts',
622 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
623 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Layouts/Default.html')->will($this->returnValue(
true));
624 $this->assertEquals(PATH_site .
'specific/Layouts/Default.html', $this->view->_call(
'getLayoutPathAndFilename'));
632 $this->view->setLayoutRootPaths(array(
633 '10' =>
'some/Default/Directory',
634 '25' =>
'evenMore/Specific/Layouts',
635 '17' =>
'specific/Layouts',
637 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
638 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default.html')->will($this->returnValue(
true));
639 $this->assertEquals(PATH_site .
'some/Default/Directory/Default.html', $this->view->_call(
'getLayoutPathAndFilename'));
649 $this->view->setLayoutRootPaths(array(
650 '10' =>
'some/Default/Directory',
651 '25' =>
'evenMore/Specific/Layouts',
652 '17' =>
'specific/Layouts',
654 $this->view->expects($this->any())->method(
'testFileExistence')->will($this->returnValue(
false));
655 $this->view->_call(
'getLayoutPathAndFilename');
663 $this->view->setPartialRootPaths(array(
'some/Default/Directory'));
664 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
665 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/PartialName.html')->willReturn(
false);
666 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/PartialName')->willReturn(
false);
667 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/partialName.html')->willReturn(
true);
668 $this->assertSame(PATH_site .
'some/Default/Directory/partialName.html', $this->view->_call(
'getPartialPathAndFilename',
'partialName'));
676 $this->view->setPartialRootPaths(array(
'some/Default/Directory'));
677 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
678 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/PartialName.html')->willReturn(
true);
679 $this->assertSame(PATH_site .
'some/Default/Directory/PartialName.html', $this->view->_call(
'getPartialPathAndFilename',
'partialName'));
687 $this->view->setPartialRootPaths(array(
688 'default' =>
'some/Default/Directory',
689 'specific' =>
'specific/Partials',
691 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
692 $this->view->expects($this->once())->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial.html')->will($this->returnValue(
true));
693 $this->assertEquals(PATH_site .
'specific/Partials/Partial.html', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
701 $this->view->setPartialRootPaths(array(
702 'default' =>
'some/Default/Directory',
703 'specific' =>
'specific/Partials',
705 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
706 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial.html')->will($this->returnValue(
true));
707 $this->assertEquals(PATH_site .
'some/Default/Directory/Partial.html', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
715 $this->view->setPartialRootPaths(array(
716 '10' =>
'some/Default/Directory',
717 '25' =>
'evenMore/Specific/Partials',
718 '17' =>
'specific/Partials',
720 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
721 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial.html')->will($this->returnValue(
true));
722 $this->assertEquals(PATH_site .
'specific/Partials/Partial.html', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
730 $this->view->setPartialRootPaths(array(
731 '10' =>
'some/Default/Directory',
732 '25' =>
'evenMore/Specific/Partials',
733 '17' =>
'specific/Partials',
735 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
736 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial.html')->will($this->returnValue(
true));
737 $this->assertEquals(PATH_site .
'some/Default/Directory/Partial.html', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
747 $this->view->setPartialRootPaths(array(
748 '10' =>
'some/Default/Directory',
749 '25' =>
'evenMore/Specific/Partials',
750 '17' =>
'specific/Partials',
752 $this->view->expects($this->any())->method(
'testFileExistence')->will($this->returnValue(
false));
753 $this->view->_call(
'getPartialPathAndFilename',
'Partial');
761 $this->view->setPartialRootPaths(array(
762 '10' =>
'some/Default/Directory',
763 '25' =>
'evenMore/Specific/Partials',
764 '17' =>
'specific/Partials',
766 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
767 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Partials/Partial.html')->will($this->returnValue(
false));
768 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Partials/Partial')->will($this->returnValue(
false));
769 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial.html')->will($this->returnValue(
false));
770 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial')->will($this->returnValue(
false));
771 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial.html')->will($this->returnValue(
false));
772 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial')->will($this->returnValue(
true));
773 $this->assertEquals(PATH_site .
'some/Default/Directory/Partial', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
781 $this->view->setLayoutRootPaths(array(
782 '10' =>
'some/Default/Directory',
783 '25' =>
'evenMore/Specific/Layouts',
784 '17' =>
'specific/Layouts',
786 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
787 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Layouts/Default.html')->will($this->returnValue(
false));
788 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Layouts/Default')->will($this->returnValue(
false));
789 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Layouts/Default.html')->will($this->returnValue(
false));
790 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Layouts/Default')->will($this->returnValue(
false));
791 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default.html')->will($this->returnValue(
false));
792 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default')->will($this->returnValue(
true));
793 $this->assertEquals(PATH_site .
'some/Default/Directory/Default', $this->view->_call(
'getLayoutPathAndFilename'));
801 $this->view->setPartialRootPaths(array(
802 'default' =>
'some/Default/Directory',
803 'specific' =>
'specific/Partials',
804 'verySpecific' =>
'evenMore/Specific/Partials',
806 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
807 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Partials/Partial.html')->will($this->returnValue(
false));
808 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Partials/Partial')->will($this->returnValue(
false));
809 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial.html')->will($this->returnValue(
false));
810 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Partials/Partial')->will($this->returnValue(
false));
811 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial.html')->will($this->returnValue(
false));
812 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Partial')->will($this->returnValue(
true));
813 $this->assertEquals(PATH_site .
'some/Default/Directory/Partial', $this->view->_call(
'getPartialPathAndFilename',
'Partial'));
821 $this->view->setLayoutRootPaths(array(
822 'default' =>
'some/Default/Directory',
823 'specific' =>
'specific/Layout',
824 'verySpecific' =>
'evenMore/Specific/Layout',
826 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
827 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Layout/Default.html')->will($this->returnValue(
false));
828 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Layout/Default')->will($this->returnValue(
false));
829 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Layout/Default.html')->will($this->returnValue(
false));
830 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Layout/Default')->will($this->returnValue(
false));
831 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default.html')->will($this->returnValue(
false));
832 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Default')->will($this->returnValue(
true));
833 $this->assertEquals(PATH_site .
'some/Default/Directory/Default', $this->view->_call(
'getLayoutPathAndFilename'));
842 $this->view->setTemplate(
'TemplateName');
851 $this->view->setTemplateRootPaths(array(
854 $this->view->setTemplate(
'NonExistingTemplateName');
862 $this->view->setTemplateRootPaths(array(
'some/Default/Directory'));
863 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
864 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/TemplateName.html')->willReturn(
false);
865 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/TemplateName')->willReturn(
false);
866 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/templateName.html')->willReturn(
true);
867 $this->view->setTemplate(
'templateName');
869 $this->assertSame(PATH_site .
'some/Default/Directory/templateName.html', $this->view->getTemplatePathAndFilename());
877 $this->view->setTemplateRootPaths(array(
'some/Default/Directory'));
878 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
879 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/TemplateName.html')->willReturn(
true);
880 $this->view->setTemplate(
'templateName');
881 $this->assertSame(PATH_site .
'some/Default/Directory/TemplateName.html', $this->view->getTemplatePathAndFilename());
889 $this->view->setTemplateRootPaths(array(
890 'default' =>
'some/Default/Directory',
891 'specific' =>
'specific/Templates',
893 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
894 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template.html')->will($this->returnValue(
true));
895 $this->view->setTemplate(
'Template');
896 $this->assertEquals(PATH_site .
'specific/Templates/Template.html', $this->view->getTemplatePathAndFilename());
904 $this->view->setTemplateRootPaths(array(
905 'default' =>
'some/Default/Directory',
906 'specific' =>
'specific/Templates',
908 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
909 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template.html')->will($this->returnValue(
true));
910 $this->view->setTemplate(
'Template');
912 $this->assertEquals(PATH_site .
'some/Default/Directory/Template.html', $this->view->getTemplatePathAndFilename());
920 $this->view->setTemplateRootPaths(array(
921 'default' =>
'some/Default/Directory',
922 'specific' =>
'specific/Templates',
924 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
925 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Email/Template.html')->will($this->returnValue(
true));
926 $this->view->setTemplate(
'Email/Template');
927 $this->assertEquals(PATH_site .
'specific/Templates/Email/Template.html', $this->view->getTemplatePathAndFilename());
935 $this->view->setTemplateRootPaths(array(
936 '10' =>
'some/Default/Directory',
937 '25' =>
'evenMore/Specific/Templates',
938 '17' =>
'specific/Templates',
940 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
941 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template.html')->will($this->returnValue(
true));
942 $this->view->setTemplate(
'Template');
943 $this->assertEquals(PATH_site .
'specific/Templates/Template.html', $this->view->getTemplatePathAndFilename());
951 $this->view->setTemplateRootPaths(array(
952 '10' =>
'some/Default/Directory',
953 '25' =>
'evenMore/Specific/Templates',
954 '17' =>
'specific/Templates',
956 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
957 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template.html')->will($this->returnValue(
true));
958 $this->view->setTemplate(
'Template');
959 $this->assertEquals(PATH_site .
'some/Default/Directory/Template.html', $this->view->getTemplatePathAndFilename());
967 $this->view->setTemplateRootPaths(array(
968 '10' =>
'some/Default/Directory',
969 '25' =>
'evenMore/Specific/Templates',
970 '17' =>
'specific/Templates',
972 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
973 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Templates/Template.html')->will($this->returnValue(
false));
974 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Templates/Template')->will($this->returnValue(
false));
975 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template.html')->will($this->returnValue(
false));
976 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template')->will($this->returnValue(
false));
977 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template.html')->will($this->returnValue(
false));
978 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template')->will($this->returnValue(
true));
979 $this->view->setTemplate(
'Template');
980 $this->assertEquals(PATH_site .
'some/Default/Directory/Template', $this->view->getTemplatePathAndFilename());
988 $this->view->setTemplateRootPaths(array(
989 'default' =>
'some/Default/Directory',
990 'specific' =>
'specific/Templates',
991 'verySpecific' =>
'evenMore/Specific/Templates',
993 $this->mockRequest->expects($this->any())->method(
'getFormat')->will($this->returnValue(
'html'));
994 $this->view->expects($this->at(0))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Templates/Template.html')->will($this->returnValue(
false));
995 $this->view->expects($this->at(1))->method(
'testFileExistence')->with(PATH_site .
'evenMore/Specific/Templates/Template')->will($this->returnValue(
false));
996 $this->view->expects($this->at(2))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template.html')->will($this->returnValue(
false));
997 $this->view->expects($this->at(3))->method(
'testFileExistence')->with(PATH_site .
'specific/Templates/Template')->will($this->returnValue(
false));
998 $this->view->expects($this->at(4))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template.html')->will($this->returnValue(
false));
999 $this->view->expects($this->at(5))->method(
'testFileExistence')->with(PATH_site .
'some/Default/Directory/Template')->will($this->returnValue(
true));
1000 $this->view->setTemplate(
'Template');
1001 $this->assertEquals(PATH_site .
'some/Default/Directory/Template', $this->view->getTemplatePathAndFilename());