2 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser;
14 use TYPO3\CMS\Core\Tests\AccessibleObjectInterface;
30 $templateParser = new \TYPO3\CMS\Fluid\Core\Parser\TemplateParser();
31 $templateParser->parse(123);
39 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
40 $templateParser->_call(
'extractNamespaceDefinitions',
' \\{namespace f4=F7\\Rocks} {namespace f4=TYPO3\Rocks\Really}');
42 'f' => \TYPO3\CMS\
Fluid\ViewHelpers::class,
43 'f4' =>
'TYPO3\Rocks\Really'
45 $this->assertEquals($expected, $templateParser->getNamespaces(),
'Namespaces do not match.');
53 $mockSettings = array(
54 'namespaces' => array(
55 'http://domain.tld/ns/my/viewhelpers' =>
'My\Namespace',
56 'http://otherdomain.tld/ns/other/viewhelpers' =>
'My\Other\Namespace'
59 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
60 $templateParser->injectSettings($mockSettings);
61 $templateParser->_call(
'extractNamespaceDefinitions',
'Some content <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f5="http://domain.tld/ns/my/viewhelpers"
62 xmlns:xyz="http://otherdomain.tld/ns/other/viewhelpers" />');
64 'f' => \TYPO3\CMS\
Fluid\ViewHelpers::class,
65 'f5' =>
'My\Namespace',
66 'xyz' =>
'My\Other\Namespace'
68 $this->assertEquals($expected, $templateParser->getNamespaces(),
'Namespaces do not match.');
76 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
77 $templateParser->_call(
'extractNamespaceDefinitions',
'<xml xmlns="http://www.w3.org/1999/xhtml" xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers" />');
79 'f' => \TYPO3\CMS\
Fluid\ViewHelpers::class,
80 'xyz' =>
'Some\Package\ViewHelpers'
82 $this->assertEquals($expected, $templateParser->getNamespaces(),
'Namespaces do not match.');
90 $mockSettings = array(
91 'namespaces' => array(
92 'http://domain.tld/ns/my/viewhelpers' =>
'My\Namespace'
95 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
96 $templateParser->injectSettings($mockSettings);
97 $templateParser->_call(
'extractNamespaceDefinitions',
'<xml xmlns="http://www.w3.org/1999/xhtml" xmlns:f5="http://domain.tld/ns/my/viewhelpers"
98 xmlns:xyz="http://otherdomain.tld/ns/other/viewhelpers" />');
100 'f' => \TYPO3\CMS\
Fluid\ViewHelpers::class,
101 'f5' =>
'My\Namespace'
103 $this->assertEquals($expected, $templateParser->getNamespaces(),
'Namespaces do not match.');
111 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
112 $templateParser->_call(
'extractNamespaceDefinitions',
'<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://domain.tld/this/will/be/ignored" />');
114 'f' => \TYPO3\CMS\
Fluid\ViewHelpers::class
116 $this->assertEquals($expected, $templateParser->getNamespaces(),
'Namespaces do not match.');
125 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
126 $templateParser->_call(
'extractNamespaceDefinitions',
'{namespace typo3=TYPO3\CMS\Fluid\Blablubb} {namespace typo3= TYPO3\Rocks\Blu}');
135 $mockSettings = array(
136 'namespaces' => array(
137 'http://domain.tld/ns/my/viewhelpers' =>
'My\Namespace'
140 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
141 $templateParser->injectSettings($mockSettings);
142 $templateParser->_call(
'extractNamespaceDefinitions',
'<foo xmlns="http://www.w3.org/1999/xhtml" xmlns:typo3="http://domain.tld/ns/my/viewhelpers" />{namespace typo3=TYPO3\CMS\Fluid\Blablubb}');
151 $mockSettings = array(
152 'namespaces' => array(
153 'http://domain.tld/ns/my/viewhelpers' =>
'My\Namespace'
156 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
157 $templateParser->injectSettings($mockSettings);
158 $templateParser->_call(
'extractNamespaceDefinitions',
'{namespace typo3=TYPO3\CMS\Fluid\Blablubb} <foo xmlns="http://www.w3.org/1999/xhtml" xmlns:typo3="http://domain.tld/ns/my/viewhelpers" />');
168 public function extractNamespaceDefinitionsCallsRemoveXmlnsViewHelperNamespaceDeclarationsWithCorrectFoundIdentifiers(array $expectedFoundIdentifiers, $templateString, array $namespaces)
170 $mockSettings = array(
171 'namespaces' => $namespaces
175 $templateParser = $this->getAccessibleMock(TemplateParser::class, array(
'removeXmlnsViewHelperNamespaceDeclarations'));
176 $templateParser->injectSettings($mockSettings);
181 ->expects($this->once())
182 ->method(
'removeXmlnsViewHelperNamespaceDeclarations')
183 ->with($templateString, $expectedFoundIdentifiers)
184 ->willReturnArgument(0);
185 $templateParser->_call(
'extractNamespaceDefinitions', $templateString);
194 'bothViewHelperNamespacesDefinitionsOnlyProvideXmlnsViewHelpersUsingNonDefaultPatternViewHelpers' => array(
196 '{namespace typo3=TYPO3\\CMS\\Fluid\\Blablubb} <div xmlns:foo="http://domain.tld/ns/foo/viewhelpers">Content</div>',
197 [
'http://domain.tld/ns/foo/viewhelpers' =>
'My\\Namespace']
199 'bothViewHelperNamespacesDefinitionsOnlyProvideXmlnsViewHelpersUsingDefaultPatternViewHelpers' => array(
201 '{namespace typo3=TYPO3\\CMS\\Fluid\\Blablubb} <div xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers">Content</div>',
204 'xmlnsIdentifiersWithWhitespaces' => array(
205 [
' ',
'foo bar',
'"x y z"'],
207 <div xmlns: ="http://typo3.org/ns/Some/Package/ViewHelpers"
208 xmlns:foo bar="http://domain.tld/ns/foobar/viewhelpers"
209 xmlns:"x y z"="http://typo3.org/ns/My/Xyz/ViewHelpers">
214 [
'http://domain.tld/ns/foobar/viewhelpers' =>
'My\\Namespace']
216 'xmlnsWithEqualsSign' => array(
217 [
'=',
'foo=bar',
'"x=y=z"'],
219 <div xmlns:=="http://typo3.org/ns/Some/Package/ViewHelpers"
220 xmlns:foo=bar="http://domain.tld/ns/foobar/viewhelpers"
221 xmlns:"x=y=z"="http://typo3.org/ns/My/Xyz/ViewHelpers">
226 [
'http://domain.tld/ns/foobar/viewhelpers' =>
'My\\Namespace']
228 'nonViewHelpersXmlnsAreNotIncludedButDefaultPatternAndNonDefaultAreIncluded' => array(
230 '<div xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers"
231 xmlns:foo="http://domain.tld/ns/foo/viewhelpers"
232 xmlns:bar="http://typo3.org/foo/bar">
236 [
'http://domain.tld/ns/foo/viewhelpers' =>
'My\\Namespace']
238 'nonViewHelpersInBetweenViewHelperXmlnsAreNotIncludedButDefaultPatternAndNonDefaultAreIncluded' => array(
240 '<div xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers"
241 xmlns:bar="http://typo3.org/foo/bar"
242 xmlns:foo="http://domain.tld/ns/foo/viewhelpers">
246 [
'http://domain.tld/ns/foo/viewhelpers' =>
'My\\Namespace']
248 'fluidNamespaceIsFound' => array(
250 '<div xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">Content</div>',
253 'xmlnsWithoutIdentifierIsIgnored' => array(
255 '<div xmlns="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">Content</div>',
258 'htmlTagAlsoFindsIdentifiers' => array(
260 '<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
261 xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers">
267 'htmlTagWithNamespaceTypo3FluidAttributeTagAlsoFindsIdentifiers' => array(
269 '<html data-namespace-typo3-fluid="true"
270 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
271 xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers">
277 'nonHtmlTagAlsoFindsIdentifiers' => array(
280 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
281 xmlns:xyz="http://typo3.org/ns/Some/Package/ViewHelpers">
299 $templateParser = $this->getAccessibleMock(TemplateParser::class, array(
'dummy'));
300 $templateString = $templateParser->_call(
'removeXmlnsViewHelperNamespaceDeclarations', $templateString, $foundIdentifiers);
303 $this->assertSame(trim(str_replace(
"\t",
'', $expectedOut)), trim(str_replace(
"\t",
'', $templateString)));
314 'onlyViewHelperXmlns' => array(
317 <f:if condition="{demo}">Hello World</f:if>
321 '<div xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
322 xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers">
323 <f:if condition="{demo}">Hello World</f:if>
326 'xmlnsViewHelpersFoundWithNonViewHelperXmlnsAtBeginning' => array(
328 <div xmlns:z="http://www.typo3.org/foo" >
329 <f:if condition="{demo}">Hello World</f:if>
334 <div xmlns:z="http://www.typo3.org/foo"
335 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
336 xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers">
337 <f:if condition="{demo}">Hello World</f:if>
341 'xmlnsViewHelpersFoundWithNonViewHelperXmlnsAtEnd' => array(
343 <div xmlns:z="http://www.typo3.org/foo">
344 <f:if condition="{demo}">Hello World</f:if>
349 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
350 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
351 xmlns:z="http://www.typo3.org/foo">
352 <f:if condition="{demo}">Hello World</f:if>
356 'xmlnsViewHelpersFoundWithMultipleNonViewHelperXmlns' => array(
358 <div xmlns:y="http://www.typo3.org/bar" xmlns:z="http://www.typo3.org/foo">
359 <f:if condition="{demo}">Hello World</f:if>
364 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
365 xmlns:y="http://www.typo3.org/bar"
366 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
367 xmlns:z="http://www.typo3.org/foo">
368 <f:if condition="{demo}">Hello World</f:if>
372 'xmlnsViewHelpersFoundWithNonViewHelperXmlnsBetween' => array(
374 <div xmlns:z="http://www.typo3.org/foo" >
375 <f:if condition="{demo}">Hello World</f:if>
380 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
381 xmlns:z="http://www.typo3.org/foo"
382 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
383 <f:if condition="{demo}">Hello World</f:if>
387 'removeHtmlTagWithAttributeButNoXmlnsViewHelpersFound' => array(
388 '<f:if condition="{demo}">Hello World</f:if>',
391 <html data-namespace-typo3-fluid="true">
392 <f:if condition="{demo}">Hello World</f:if>
396 'doNotRemoveHtmlTagBecauseHtmlTagNotMarkedAsFluidNamespaceDefinitionTag' => array(
398 <html xmlns:z="http://www.typo3.org/foo">
399 <f:if condition="{demo}">Hello World</f:if>
404 <html xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
405 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
406 xmlns:z="http://www.typo3.org/foo">
407 <f:if condition="{demo}">Hello World</f:if>
411 'doNotModifyHtmlTagBecauseViewHelperXmlnsNotFoundInTagAndNotMarkedForRemoval' => array(
413 <html xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
414 xmlns:z="http://www.typo3.org/foo">
415 <f:if condition="{demo}">Hello World</f:if>
420 <html xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
421 xmlns:z="http://www.typo3.org/foo">
422 <f:if condition="{demo}">Hello World</f:if>
426 'removeHtmlTagBecauseXmlnsFoundInTagAndMarkedAsFluidViewHelperDefinitionTag' => array(
427 '<f:if condition="{demo}">Hello World</f:if>',
430 <html data-namespace-typo3-fluid="true"
431 xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
432 xmlns:z="http://www.typo3.org/foo">
433 <f:if condition="{demo}">Hello World</f:if>
437 'removeHtmlTagBecauseXmlnsFoundInDifferentTagAndMarkedAsFluidViewHelperDefinitionTag' => array(
438 '<f:if condition="{demo}">Hello World</f:if>',
441 <html data-namespace-typo3-fluid="true" xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
442 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
443 xmlns:z="http://www.typo3.org/foo">
444 <f:if condition="{demo}">Hello World</f:if>
448 'producesExcpedtedOutputIfFouundIdentifiersAreWrongButContainNoExistingNonViewHelperXmlns' => array(
450 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers" xmlns:z="http://www.typo3.org/foo">
451 <f:if condition="{demo}">Hello World</f:if>
456 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
457 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
458 xmlns:z="http://www.typo3.org/foo">
459 <f:if condition="{demo}">Hello World</f:if>
466 'removesNonViewHelperNamespaceIfFoundIdentifiersAreWrong' => array(
468 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers" >
469 <f:if condition="{demo}">Hello World</f:if>
474 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
475 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
476 xmlns:z="http://www.typo3.org/foo">
477 <f:if condition="{demo}">Hello World</f:if>
484 'xmlnsWithScanPatternAsIdentifier' => array(
487 <f:if condition="{demo}">Hello World</f:if>
493 <f:if condition="{demo}">Hello World</f:if>
501 'xmlnsIdentifiersWithWhitespaces' => array(
503 <div xmlns:none xyz="http://domain.tld/ns/NoneXyz/viewhelpers" >
505 <f:if condition="{demo}">Hello World</f:if>
508 [
' ',
'foo bar',
'"x y z"'],
510 <div xmlns: ="http://typo3.org/ns/Some/Package/ViewHelpers"
511 xmlns:foo bar="http://domain.tld/ns/foobar/viewhelpers"
512 xmlns:none xyz="http://domain.tld/ns/NoneXyz/viewhelpers"
513 xmlns:"x y z"="http://typo3.org/ns/My/Xyz/ViewHelpers">
515 <f:if condition="{demo}">Hello World</f:if>
519 'xmlnsWithRegularExpressionAsIdentifier' => array(
521 <div xmlns:z="http://www.typo3.org/foo">
522 <f:if condition="{demo}">Hello World</f:if>
525 [
'f',
'fe',
'.*.?\\s'],
527 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
528 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
529 xmlns:.*.?\\s="http://typo3.org/ns/TYPO3/CMS\Demo/ViewHelpers"
530 xmlns:z="http://www.typo3.org/foo">
531 <f:if condition="{demo}">Hello World</f:if>
535 'xmlnsWithRegularExpressionDelimiterAsIdentifier' => array(
537 <div xmlns:z="http://www.typo3.org/foo">
538 <f:if condition="{demo}">Hello World</f:if>
543 <div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"
544 xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
545 xmlns:/="http://typo3.org/ns/TYPO3/CMS\Demo/ViewHelpers"
546 xmlns:z="http://www.typo3.org/foo">
547 <f:if condition="{demo}">Hello World</f:if>
551 'xmlnsWithEqualsSign' => array(
553 <div xmlns:none=xyz="http://domain.tld/ns/NoneXyz/viewhelpers" >
555 <f:if condition="{demo}">Hello World</f:if>
558 [
'=',
'foo=bar',
'"x=y=z"'],
560 <div xmlns:=="http://typo3.org/ns/Some/Package/ViewHelpers"
561 xmlns:foo=bar="http://domain.tld/ns/foobar/viewhelpers"
562 xmlns:none=xyz="http://domain.tld/ns/NoneXyz/viewhelpers"
563 xmlns:"x=y=z"="http://typo3.org/ns/My/Xyz/ViewHelpers">
565 <f:if condition="{demo}">Hello World</f:if>
577 $mockTemplateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'), array(),
'',
false);
578 $result = $mockTemplateParser->_call(
'resolveViewHelperName',
'f',
'foo.bar.baz');
579 $expected =
'TYPO3\CMS\Fluid\ViewHelpers\Foo\Bar\BazViewHelper';
580 $this->assertEquals($expected, $result,
'The name of the View Helper Name could not be resolved.');
588 $mockTemplateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'), array(),
'',
false);
589 $actual = $mockTemplateParser->_call(
'resolveViewHelperName',
'f',
'myown');
590 $expected =
'TYPO3\CMS\Fluid\ViewHelpers\MyownViewHelper';
591 $this->assertEquals($expected, $actual);
599 array(
'"no quotes here"',
'no quotes here'),
600 array(
"'no quotes here'",
'no quotes here'),
601 array(
"'this \"string\" had \\'quotes\\' in it'",
'this "string" had \'quotes\' in it'),
602 array(
'"this \\"string\\" had \'quotes\' in it"',
'this "string" had \'quotes\' in it'),
603 array(
'"a weird \"string\" \'with\' *freaky* \\\\stuff',
'a weird "string" \'with\' *freaky* \\stuff'),
604 array(
'\'\\\
'escaped quoted string in string\\\'\'',
'\'escaped quoted
string in
string\
'')
614 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
615 $this->assertEquals($unquoted, $templateParser->_call(
'unquoteString', $quoted));
623 array(
'TemplateParserTestFixture01-shorthand'),
624 array(
'TemplateParserTestFixture06'),
625 array(
'TemplateParserTestFixture14')
635 $template = file_get_contents(__DIR__ .
'/Fixtures/' . $templateName .
'.html', FILE_TEXT);
636 $expectedResult = require(__DIR__ .
'/Fixtures/' . $templateName .
'-split.php');
637 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
638 $this->assertSame($expectedResult, $templateParser->_call(
'splitTemplateAtDynamicTags', $template),
'Filed for ' . $templateName);
646 $mockRootNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class);
648 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
649 $mockState->expects($this->once())->method(
'setRootNode')->with($mockRootNode);
650 $mockState->expects($this->once())->method(
'pushNodeToStack')->with($mockRootNode);
651 $mockState->expects($this->once())->method(
'countNodeStack')->will($this->returnValue(1));
653 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
654 $mockObjectManager->expects($this->at(0))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class)->will($this->returnValue($mockState));
655 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class)->will($this->returnValue($mockRootNode));
657 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
658 $templateParser->_set(
'objectManager', $mockObjectManager);
668 $mockRootNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class);
670 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
671 $mockState->expects($this->once())->method(
'countNodeStack')->will($this->returnValue(2));
673 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
674 $mockObjectManager->expects($this->at(0))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class)->will($this->returnValue($mockState));
675 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class)->will($this->returnValue($mockRootNode));
677 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
678 $templateParser->_set(
'objectManager', $mockObjectManager);
687 $mockRootNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class);
688 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
689 $mockState->expects($this->once())->method(
'countNodeStack')->will($this->returnValue(1));
690 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
691 $mockObjectManager->expects($this->at(0))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class)->will($this->returnValue($mockState));
692 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\RootNode::class)->will($this->returnValue($mockRootNode));
694 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'textHandler',
'openingViewHelperTagHandler',
'closingViewHelperTagHandler',
'textAndShorthandSyntaxHandler'));
695 $templateParser->_set(
'objectManager', $mockObjectManager);
696 $templateParser->expects($this->at(0))->method(
'textAndShorthandSyntaxHandler')->with($mockState,
'The first part is simple');
697 $templateParser->expects($this->at(1))->method(
'textHandler')->with($mockState,
'<f:for each="{a: {a: 0, b: 2, c: 4}}" as="array"><f:for each="{array}" as="value">{value} </f:for>');
698 $templateParser->expects($this->at(2))->method(
'openingViewHelperTagHandler')->with($mockState,
'f',
'format.printf',
' arguments="{number : 362525200}"',
false);
699 $templateParser->expects($this->at(3))->method(
'textAndShorthandSyntaxHandler')->with($mockState,
'%.3e');
700 $templateParser->expects($this->at(4))->method(
'closingViewHelperTagHandler')->with($mockState,
'f',
'format.printf');
701 $templateParser->expects($this->at(5))->method(
'textAndShorthandSyntaxHandler')->with($mockState,
'and here goes some {text} that could have {shorthand}');
703 $splitTemplate = $templateParser->_call(
'splitTemplateAtDynamicTags',
'The first part is simple<![CDATA[<f:for each="{a: {a: 0, b: 2, c: 4}}" as="array"><f:for each="{array}" as="value">{value} </f:for>]]><f:format.printf arguments="{number : 362525200}">%.3e</f:format.printf>and here goes some {text} that could have {shorthand}');
712 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
713 $mockState->expects($this->never())->method(
'popNodeFromStack');
715 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'parseArguments',
'initializeViewHelperAndAddItToStack'));
716 $templateParser->expects($this->once())->method(
'parseArguments')->with(array(
'arguments'))->will($this->returnValue(array(
'parsedArguments')));
717 $templateParser->expects($this->once())->method(
'initializeViewHelperAndAddItToStack')->with($mockState,
'namespaceIdentifier',
'methodIdentifier', array(
'parsedArguments'));
719 $templateParser->_call(
'openingViewHelperTagHandler', $mockState,
'namespaceIdentifier',
'methodIdentifier', array(
'arguments'),
false);
727 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
728 $mockState->expects($this->once())->method(
'popNodeFromStack')->will($this->returnValue($this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class)));
730 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'parseArguments',
'initializeViewHelperAndAddItToStack'));
732 $templateParser->_call(
'openingViewHelperTagHandler', $mockState,
'',
'', array(),
true);
740 $mockViewHelper = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\AbstractViewHelper::class);
741 $mockViewHelperNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, array(), array(),
'',
false);
743 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class);
744 $mockNodeOnStack->expects($this->once())->method(
'addChildNode')->with($mockViewHelperNode);
746 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
747 $mockObjectManager->expects($this->at(0))->method(
'get')->with(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
748 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class)->will($this->returnValue($mockViewHelperNode));
750 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
751 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
752 $mockState->expects($this->once())->method(
'pushNodeToStack')->with($mockViewHelperNode);
754 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'abortIfUnregisteredArgumentsExist',
'abortIfRequiredArgumentsAreMissing',
'rewriteBooleanNodesInArgumentsObjectTree'));
755 $templateParser->_set(
'objectManager', $mockObjectManager);
757 $templateParser->_call(
'initializeViewHelperAndAddItToStack', $mockState,
'f',
'myown', array(
'arguments'));
765 $expectedArguments = array(
'expectedArguments');
766 $argumentsObjectTree = array(
'arguments');
768 $mockViewHelper = $this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\AbstractViewHelper::class);
769 $mockViewHelper->expects($this->once())->method(
'prepareArguments')->will($this->returnValue($expectedArguments));
770 $mockViewHelperNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, array(), array(),
'',
false);
772 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class);
774 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
775 $mockObjectManager->expects($this->at(0))->method(
'get')->with(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
776 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class)->will($this->returnValue($mockViewHelperNode));
778 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
779 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
781 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'abortIfUnregisteredArgumentsExist',
'abortIfRequiredArgumentsAreMissing',
'rewriteBooleanNodesInArgumentsObjectTree'));
782 $templateParser->_set(
'objectManager', $mockObjectManager);
783 $templateParser->expects($this->once())->method(
'abortIfUnregisteredArgumentsExist')->with($expectedArguments, $argumentsObjectTree);
784 $templateParser->expects($this->once())->method(
'abortIfRequiredArgumentsAreMissing')->with($expectedArguments, $argumentsObjectTree);
786 $templateParser->_call(
'initializeViewHelperAndAddItToStack', $mockState,
'f',
'myown', $argumentsObjectTree);
794 $mockViewHelper = $this->getMock(\TYPO3\CMS\
Fluid\Tests\Unit\Core\Parser\Fixtures\PostParseFacetViewHelper::class, array(
'prepareArguments'));
795 $mockViewHelperNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, array(), array(),
'',
false);
797 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class);
798 $mockNodeOnStack->expects($this->once())->method(
'addChildNode')->with($mockViewHelperNode);
800 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
801 $mockObjectManager->expects($this->at(0))->method(
'get')->with(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\MyownViewHelper')->will($this->returnValue($mockViewHelper));
802 $mockObjectManager->expects($this->at(1))->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class)->will($this->returnValue($mockViewHelperNode));
804 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
805 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
806 $mockState->expects($this->once())->method(
'getVariableContainer')->will($this->returnValue($this->getMock(\TYPO3\CMS\
Fluid\Core\ViewHelper\TemplateVariableContainer::class)));
808 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'abortIfUnregisteredArgumentsExist',
'abortIfRequiredArgumentsAreMissing',
'rewriteBooleanNodesInArgumentsObjectTree'));
809 $templateParser->_set(
'objectManager', $mockObjectManager);
811 $templateParser->_call(
'initializeViewHelperAndAddItToStack', $mockState,
'f',
'myown', array(
'arguments'));
812 $this->assertTrue(\TYPO3\CMS\
Fluid\Tests\Unit\Core\Parser\Fixtures\PostParseFacetViewHelper::$wasCalled,
'PostParse was not called!');
821 $expected = array(
new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'firstArgument',
'string',
'',
false));
822 $actual = array(
'firstArgument' =>
'foo',
'secondArgument' =>
'bar');
824 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
826 $templateParser->_call(
'abortIfUnregisteredArgumentsExist', $expected, $actual);
834 $expectedArguments = array(
835 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'name1',
'string',
'desc',
false),
836 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'name2',
'string',
'desc',
true)
838 $actualArguments = array(
842 $mockTemplateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
844 $mockTemplateParser->_call(
'abortIfUnregisteredArgumentsExist', $expectedArguments, $actualArguments);
846 $this->assertTrue(
true);
856 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'firstArgument',
'string',
'',
false),
857 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'secondArgument',
'string',
'',
true)
860 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
862 $templateParser->_call(
'abortIfRequiredArgumentsAreMissing', $expected, array());
870 $expectedArguments = array(
871 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'name1',
'string',
'desc',
false),
872 new \TYPO3\CMS\
Fluid\Core\ViewHelper\ArgumentDefinition(
'name2',
'string',
'desc',
true)
874 $actualArguments = array(
878 $mockTemplateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
880 $mockTemplateParser->_call(
'abortIfRequiredArgumentsAreMissing', $expectedArguments, $actualArguments);
882 $this->assertTrue(
true);
891 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class, array(), array(),
'',
false);
892 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
893 $mockState->expects($this->once())->method(
'popNodeFromStack')->will($this->returnValue($mockNodeOnStack));
895 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
897 $templateParser->_call(
'closingViewHelperTagHandler', $mockState,
'f',
'method');
906 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, array(), array(),
'',
false);
907 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
908 $mockState->expects($this->once())->method(
'popNodeFromStack')->will($this->returnValue($mockNodeOnStack));
910 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
912 $templateParser->_call(
'closingViewHelperTagHandler', $mockState,
'f',
'method');
920 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
921 $mockState->expects($this->exactly(2))->method(
'popNodeFromStack')->will($this->returnValue($this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\NodeInterface::class)));
923 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'recursiveArrayHandler',
'postProcessArgumentsForObjectAccessor',
'initializeViewHelperAndAddItToStack'));
924 $templateParser->expects($this->at(0))->method(
'recursiveArrayHandler')->with(
'format: "H:i"')->will($this->returnValue(array(
'format' =>
'H:i')));
925 $templateParser->expects($this->at(1))->method(
'postProcessArgumentsForObjectAccessor')->with(array(
'format' =>
'H:i'))->will($this->returnValue(array(
'processedArguments')));
926 $templateParser->expects($this->at(2))->method(
'initializeViewHelperAndAddItToStack')->with($mockState,
'f',
'format.date', array(
'processedArguments'));
927 $templateParser->expects($this->at(3))->method(
'initializeViewHelperAndAddItToStack')->with($mockState,
'f',
'base', array());
929 $templateParser->_call(
'objectAccessorHandler', $mockState,
'',
'',
'f:base() f:format.date(format: "H:i")',
'');
937 $objectAccessorNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::class, array(), array(),
'',
false);
939 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
940 $mockObjectManager->expects($this->once())->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::class,
'objectAccessorString')->will($this->returnValue($objectAccessorNode));
942 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\AbstractNode::class, array(), array(),
'',
false);
943 $mockNodeOnStack->expects($this->once())->method(
'addChildNode')->with($objectAccessorNode);
944 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
945 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
947 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
948 $templateParser->_set(
'objectManager', $mockObjectManager);
950 $templateParser->_call(
'objectAccessorHandler', $mockState,
'objectAccessorString',
'',
'',
'');
958 $objectAccessorNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::class, array(), array(),
'',
false);
959 $objectAccessorNodeInterceptor = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\InterceptorInterface::class);
960 $objectAccessorNodeInterceptor->expects($this->once())->method(
'process')->with($objectAccessorNode)->will($this->returnArgument(0));
962 $parserConfiguration = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\Configuration::class);
963 $parserConfiguration->expects($this->once())->method(
'getInterceptors')->with(\TYPO3\CMS\
Fluid\Core\Parser\InterceptorInterface::INTERCEPT_OBJECTACCESSOR)->will($this->returnValue(array($objectAccessorNodeInterceptor)));
965 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
966 $mockObjectManager->expects($this->once())->method(
'get')->will($this->returnValue($objectAccessorNode));
968 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\AbstractNode::class, array(), array(),
'',
false);
969 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
970 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
972 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
973 $templateParser->_set(
'objectManager', $mockObjectManager);
974 $templateParser->_set(
'configuration', $parserConfiguration);
976 $templateParser->_call(
'objectAccessorHandler', $mockState,
'objectAccessorString',
'',
'',
'');
984 array(
'a="2"', array(
'a' =>
'2')),
985 array(
'a="2" b="foobar \' with \\" quotes"', array(
'a' =>
'2',
'b' =>
'foobar \' with " quotes')),
986 array(
' arguments="{number : 362525200}"', array(
'arguments' =>
'{number : 362525200}'))
998 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'buildArgumentObjectTree'));
999 $templateParser->expects($this->any())->method(
'buildArgumentObjectTree')->will($this->returnArgument(0));
1001 $this->assertSame($expected, $templateParser->_call(
'parseArguments', $argumentsString));
1009 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
1010 $mockObjectManager->expects($this->once())->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\TextNode::class,
'a very plain string')->will($this->returnValue(
'theTextNode'));
1012 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'dummy'));
1013 $templateParser->_set(
'objectManager', $mockObjectManager);
1015 $this->assertEquals(
'theTextNode', $templateParser->_call(
'buildArgumentObjectTree',
'a very plain string'));
1023 $objectTree = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
1024 $objectTree->expects($this->once())->method(
'getRootNode')->will($this->returnValue(
'theRootNode'));
1026 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'splitTemplateAtDynamicTags',
'buildObjectTree'));
1027 $templateParser->expects($this->at(0))->method(
'splitTemplateAtDynamicTags')->with(
'a <very> {complex} string')->will($this->returnValue(
'split string'));
1028 $templateParser->expects($this->at(1))->method(
'buildObjectTree')->with(
'split string')->will($this->returnValue($objectTree));
1030 $this->assertEquals(
'theRootNode', $templateParser->_call(
'buildArgumentObjectTree',
'a <very> {complex} string'));
1038 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
1039 $mockObjectManager->expects($this->any())->method(
'get')->will($this->returnArgument(1));
1040 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
1042 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'objectAccessorHandler',
'arrayHandler',
'textHandler'));
1043 $templateParser->_set(
'objectManager', $mockObjectManager);
1044 $templateParser->expects($this->at(0))->method(
'objectAccessorHandler')->with($mockState,
'someThing.absolutely',
'',
'',
'');
1045 $templateParser->expects($this->at(1))->method(
'textHandler')->with($mockState,
' "fishy" is \'going\' ');
1046 $templateParser->expects($this->at(2))->method(
'arrayHandler')->with($mockState,
'on: "here"');
1048 $text =
'{someThing.absolutely} "fishy" is \'going\' {on: "here"}';
1057 $arrayNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ArrayNode::class, array(), array(array()));
1058 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\AbstractNode::class, array(), array(),
'',
false);
1059 $mockNodeOnStack->expects($this->once())->method(
'addChildNode')->with($arrayNode);
1060 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
1061 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
1063 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
1064 $mockObjectManager->expects($this->once())->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\ArrayNode::class,
'processedArrayText')->will($this->returnValue($arrayNode));
1066 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'recursiveArrayHandler'));
1067 $templateParser->_set(
'objectManager', $mockObjectManager);
1068 $templateParser->expects($this->once())->method(
'recursiveArrayHandler')->with(
'arrayText')->will($this->returnValue(
'processedArrayText'));
1070 $templateParser->_call(
'arrayHandler', $mockState,
'arrayText');
1079 'key1: "foo", key2: \'bar\', key3: someVar, key4: 123, key5: { key6: "baz" }',
1080 array(
'key1' =>
'foo',
'key2' =>
'bar',
'key3' =>
'someVar',
'key4' => 123.0,
'key5' => array(
'key6' =>
'baz'))
1083 'key1: "\'foo\'", key2: \'\\\'bar\\\'\'',
1084 array(
'key1' =>
'\'foo\
'',
'key2' =>
'\'bar\
'')
1095 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
1096 $mockObjectManager->expects($this->any())->method(
'get')->will($this->returnArgument(1));
1098 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'buildArgumentObjectTree'));
1099 $templateParser->_set(
'objectManager', $mockObjectManager);
1100 $templateParser->expects($this->any())->method(
'buildArgumentObjectTree')->will($this->returnArgument(0));
1102 $this->assertSame($expectedArray, $templateParser->_call(
'recursiveArrayHandler', $arrayText));
1110 $textNode = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\TextNode::class, array(), array(),
'',
false);
1111 $textInterceptor = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\InterceptorInterface::class);
1112 $textInterceptor->expects($this->once())->method(
'process')->with($textNode)->will($this->returnArgument(0));
1114 $parserConfiguration = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\Configuration::class);
1115 $parserConfiguration->expects($this->once())->method(
'getInterceptors')->with(\TYPO3\CMS\
Fluid\Core\Parser\InterceptorInterface::INTERCEPT_TEXT)->will($this->returnValue(array($textInterceptor)));
1117 $mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
1118 $mockObjectManager->expects($this->once())->method(
'get')->with(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\TextNode::class,
'string')->will($this->returnValue($textNode));
1120 $mockNodeOnStack = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\SyntaxTree\AbstractNode::class, array(), array(),
'',
false);
1121 $mockNodeOnStack->expects($this->once())->method(
'addChildNode')->with($textNode);
1122 $mockState = $this->getMock(\TYPO3\CMS\
Fluid\Core\Parser\ParsingState::class);
1123 $mockState->expects($this->once())->method(
'getNodeFromStack')->will($this->returnValue($mockNodeOnStack));
1125 $templateParser = $this->getAccessibleMock(\TYPO3\CMS\
Fluid\Core\Parser\TemplateParser::class, array(
'splitTemplateAtDynamicTags',
'buildObjectTree'));
1126 $templateParser->_set(
'objectManager', $mockObjectManager);
1127 $templateParser->_set(
'configuration', $parserConfiguration);
1129 $templateParser->_call(
'textHandler', $mockState,
'string');