2 namespace TYPO3\CMS\Fluid\Tests\Unit\View;
14 use TYPO3\CMS\Core\Tests\AccessibleObjectInterface;
15 use TYPO3\CMS\Core\Tests\UnitTestCase;
53 $this->templateVariableContainer = $this->getMock(TemplateVariableContainer::class, array(
'exists',
'remove',
'add'));
54 $this->viewHelperVariableContainer = $this->getMock(ViewHelperVariableContainer::class, array(
'setView'));
55 $this->renderingContext = $this->getMock(RenderingContext::class, array(
'getViewHelperVariableContainer',
'getTemplateVariableContainer'));
56 $this->renderingContext->expects($this->any())->method(
'getViewHelperVariableContainer')->will($this->returnValue($this->viewHelperVariableContainer));
57 $this->renderingContext->expects($this->any())->method(
'getTemplateVariableContainer')->will($this->returnValue($this->templateVariableContainer));
58 $this->view = $this->getAccessibleMock(AbstractTemplateView::class, array(
'getTemplateSource',
'getLayoutSource',
'getPartialSource',
'canRender',
'getTemplateIdentifier',
'getLayoutIdentifier',
'getPartialIdentifier'));
59 $this->view->setRenderingContext($this->renderingContext);
67 $this->viewHelperVariableContainer->expects($this->once())->method(
'setView')->with($this->view);
68 $this->view->setRenderingContext($this->renderingContext);
76 $this->templateVariableContainer->expects($this->at(0))->method(
'exists')->with(
'foo')->will($this->returnValue(
false));
77 $this->templateVariableContainer->expects($this->at(1))->method(
'add')->with(
'foo',
'FooValue');
78 $this->templateVariableContainer->expects($this->at(2))->method(
'exists')->with(
'bar')->will($this->returnValue(
false));
79 $this->templateVariableContainer->expects($this->at(3))->method(
'add')->with(
'bar',
'BarValue');
82 ->assign(
'foo',
'FooValue')
83 ->assign(
'bar',
'BarValue');
91 $this->templateVariableContainer->expects($this->at(0))->method(
'exists')->with(
'foo')->will($this->returnValue(
false));
92 $this->templateVariableContainer->expects($this->at(1))->method(
'add')->with(
'foo',
'FooValue');
93 $this->templateVariableContainer->expects($this->at(2))->method(
'exists')->with(
'foo')->will($this->returnValue(
true));
94 $this->templateVariableContainer->expects($this->at(3))->method(
'remove')->with(
'foo');
95 $this->templateVariableContainer->expects($this->at(4))->method(
'add')->with(
'foo',
'FooValueOverridden');
97 $this->view->assign(
'foo',
'FooValue');
98 $this->view->assign(
'foo',
'FooValueOverridden');
106 $this->templateVariableContainer->expects($this->at(0))->method(
'exists')->with(
'foo')->will($this->returnValue(
false));
107 $this->templateVariableContainer->expects($this->at(1))->method(
'add')->with(
'foo',
'FooValue');
108 $this->templateVariableContainer->expects($this->at(2))->method(
'exists')->with(
'bar')->will($this->returnValue(
false));
109 $this->templateVariableContainer->expects($this->at(3))->method(
'add')->with(
'bar',
'BarValue');
110 $this->templateVariableContainer->expects($this->at(4))->method(
'exists')->with(
'baz')->will($this->returnValue(
false));
111 $this->templateVariableContainer->expects($this->at(5))->method(
'add')->with(
'baz',
'BazValue');
114 ->assignMultiple(array(
'foo' =>
'FooValue',
'bar' =>
'BarValue'))
115 ->assignMultiple(array(
'baz' =>
'BazValue'));
123 $this->templateVariableContainer->expects($this->at(0))->method(
'exists')->with(
'foo')->will($this->returnValue(
false));
124 $this->templateVariableContainer->expects($this->at(1))->method(
'add')->with(
'foo',
'FooValue');
125 $this->templateVariableContainer->expects($this->at(2))->method(
'exists')->with(
'foo')->will($this->returnValue(
true));
126 $this->templateVariableContainer->expects($this->at(3))->method(
'remove')->with(
'foo');
127 $this->templateVariableContainer->expects($this->at(4))->method(
'add')->with(
'foo',
'FooValueOverridden');
128 $this->templateVariableContainer->expects($this->at(5))->method(
'exists')->with(
'bar')->will($this->returnValue(
false));
129 $this->templateVariableContainer->expects($this->at(6))->method(
'add')->with(
'bar',
'BarValue');
131 $this->view->assign(
'foo',
'FooValue');
132 $this->view->assignMultiple(array(
'foo' =>
'FooValueOverridden',
'bar' =>
'BarValue'));
141 'keeps ucfirst' => [
'LayoutPath',
'LayoutPath'],
142 'creates ucfirst' => [
'layoutPath',
'LayoutPath'],
143 'ucfirst on file name only' => [
'some/path/layout',
'some/path/Layout'],
144 'keeps ucfirst on file name' => [
'some/Path/Layout',
'some/Path/Layout'],
156 $this->assertSame($expected, $this->view->_call(
'ucFileNameInPath', $path));