TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
EscapeChildrenRenderingStandaloneTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\Fluid\Tests\Functional;
3 
6 
8 {
9  protected $testExtensionsToLoad = ['typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test'];
10 
11  protected $coreExtensionsToLoad = ['fluid'];
12 
14  {
15  return [
16  'EscapeChildrenEnabledAndEscapeOutputDisabled: Tag syntax with children, properly encodes variable value' =>
17  [
18  '<ft:escapeChildrenEnabledAndEscapeOutputDisabled>{settings.test}</ft:escapeChildrenEnabledAndEscapeOutputDisabled>',
19  '&lt;strong&gt;Bla&lt;/strong&gt;'
20  ],
21  'EscapeChildrenEnabledAndEscapeOutputDisabled: Inline syntax with children, properly encodes variable value' =>
22  [
23  '{settings.test -> ft:escapeChildrenEnabledAndEscapeOutputDisabled()}',
24  '&lt;strong&gt;Bla&lt;/strong&gt;'
25  ],
26  'EscapeChildrenEnabledAndEscapeOutputDisabled: Tag syntax with argument, does not encode variable value' =>
27  [
28  '<ft:escapeChildrenEnabledAndEscapeOutputDisabled content="{settings.test}" />',
29  '<strong>Bla</strong>'
30  ],
31  'EscapeChildrenEnabledAndEscapeOutputDisabled: Inline syntax with argument, does not encode variable value' =>
32  [
33  '{ft:escapeChildrenEnabledAndEscapeOutputDisabled(content: settings.test)}',
34  '<strong>Bla</strong>'
35  ],
36  'EscapeChildrenEnabledAndEscapeOutputDisabled: Inline syntax with string, does not encode string value' =>
37  [
38  '{ft:escapeChildrenEnabledAndEscapeOutputDisabled(content: \'<strong>Bla</strong>\')}',
39  '<strong>Bla</strong>'
40  ],
41  'EscapeChildrenEnabledAndEscapeOutputDisabled: Inline syntax with argument in quotes, does encode variable value (encoded before passed to VH)' =>
42  [
43  '{ft:escapeChildrenEnabledAndEscapeOutputDisabled(content: \'{settings.test}\')}',
44  '&lt;strong&gt;Bla&lt;/strong&gt;'
45  ],
46  'EscapeChildrenEnabledAndEscapeOutputDisabled: Tag syntax with nested inline syntax and children rendering, does not encode variable value' =>
47  [
48  '<ft:escapeChildrenEnabledAndEscapeOutputDisabled content="{settings.test -> ft:escapeChildrenEnabledAndEscapeOutputDisabled()}" />',
49  '<strong>Bla</strong>'
50  ],
51  'EscapeChildrenEnabledAndEscapeOutputDisabled: Tag syntax with nested inline syntax and argument in inline, does not encode variable value' =>
52  [
53  '<ft:escapeChildrenEnabledAndEscapeOutputDisabled content="{ft:escapeChildrenEnabledAndEscapeOutputDisabled(content: settings.test)}" />',
54  '<strong>Bla</strong>'
55  ],
56 
57  'EscapeChildrenDisabledAndEscapeOutputDisabled: Tag syntax with children, properly encodes variable value' =>
58  [
59  '<ft:escapeChildrenDisabledAndEscapeOutputDisabled>{settings.test}</ft:escapeChildrenDisabledAndEscapeOutputDisabled>',
60  '<strong>Bla</strong>'
61  ],
62  'EscapeChildrenDisabledAndEscapeOutputDisabled: Inline syntax with children, properly encodes variable value' =>
63  [
64  '{settings.test -> ft:escapeChildrenDisabledAndEscapeOutputDisabled()}',
65  '<strong>Bla</strong>'
66  ],
67  'EscapeChildrenDisabledAndEscapeOutputDisabled: Tag syntax with argument, does not encode variable value' =>
68  [
69  '<ft:escapeChildrenDisabledAndEscapeOutputDisabled content="{settings.test}" />',
70  '<strong>Bla</strong>'
71  ],
72  'EscapeChildrenDisabledAndEscapeOutputDisabled: Inline syntax with argument, does not encode variable value' =>
73  [
74  '{ft:escapeChildrenDisabledAndEscapeOutputDisabled(content: settings.test)}',
75  '<strong>Bla</strong>'
76  ],
77  'EscapeChildrenDisabledAndEscapeOutputDisabled: Inline syntax with string, does not encode string value' =>
78  [
79  '{ft:escapeChildrenDisabledAndEscapeOutputDisabled(content: \'<strong>Bla</strong>\')}',
80  '<strong>Bla</strong>'
81  ],
82  'EscapeChildrenDisabledAndEscapeOutputDisabled: Inline syntax with argument in quotes, does encode variable value (encoded before passed to VH)' =>
83  [
84  '{ft:escapeChildrenDisabledAndEscapeOutputDisabled(content: \'{settings.test}\')}',
85  '&lt;strong&gt;Bla&lt;/strong&gt;'
86  ],
87  'EscapeChildrenDisabledAndEscapeOutputDisabled: Tag syntax with nested inline syntax and children rendering, does not encode variable value' =>
88  [
89  '<ft:escapeChildrenDisabledAndEscapeOutputDisabled content="{settings.test -> ft:escapeChildrenDisabledAndEscapeOutputDisabled()}" />',
90  '<strong>Bla</strong>'
91  ],
92  'EscapeChildrenDisabledAndEscapeOutputDisabled: Tag syntax with nested inline syntax and argument in inline, does not encode variable value' =>
93  [
94  '<ft:escapeChildrenDisabledAndEscapeOutputDisabled content="{ft:escapeChildrenDisabledAndEscapeOutputDisabled(content: settings.test)}" />',
95  '<strong>Bla</strong>'
96  ],
97 
98  ];
99  }
100 
108  public function renderingTest($viewHelperTemplate, $expectedOutput)
109  {
110  $view = new StandaloneView();
111  $view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers');
112  $view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate);
113 
114  $view->assign('settings', ['test' => '<strong>Bla</strong>']);
115 
116  $this->assertSame($expectedOutput, $view->render());
117  }
118 }