‪TYPO3CMS  9.5
ActionMenuItemViewHelperTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
22 
23 class ‪ActionMenuItemViewHelperTest extends FunctionalTestCase
24 {
25  public function ‪isRenderedDataProvider(): array
26  {
27  return [
28  'tag syntax' => [
29  '<f:be.menus.actionMenuItem label="{label}" controller="{controller}" action="{action}" />',
30  [
31  'label' => 'label<>&"\'',
32  'controller' => 'controller<>&"\'',
33  'action' => 'action<>&"\'',
34  ],
35  '<option value="">label&lt;&gt;&amp;&quot;&#039;</option>',
36  ],
37  'inline syntax' => [
38  '{f:be.menus.actionMenuItem(label:label, controller:controller, action:action)}',
39  [
40  'label' => 'label<>&"\'',
41  'controller' => 'controller<>&"\'',
42  'action' => 'action<>&"\'',
43  ],
44  '<option value="">label&lt;&gt;&amp;&quot;&#039;</option>',
45  ],
46  'inline syntax with quotes' => [
47  '{f:be.menus.actionMenuItem(label:\'{label}\', controller:\'{controller}\', action:\'{action}\')}',
48  [
49  'label' => 'label<>&"\'',
50  'controller' => 'controller<>&"\'',
51  'action' => 'action<>&"\'',
52  ],
53  '<option value="">label&lt;&gt;&amp;&quot;&#039;</option>',
54  ],
55  ];
56  }
57 
66  public function ‪isRendered(string $source, array $variables, string $expectation): void
67  {
68  $view = new ‪StandaloneView();
69  $view->setTemplateSource($source);
70  $view->assignMultiple($variables);
71  self::assertSame($expectation, $view->render());
72  }
73 }
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Be\Menus\ActionMenuItemViewHelperTest
Definition: ActionMenuItemViewHelperTest.php:24
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Be\Menus
Definition: ActionMenuItemViewHelperTest.php:18
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Be\Menus\ActionMenuItemViewHelperTest\isRendered
‪isRendered(string $source, array $variables, string $expectation)
Definition: ActionMenuItemViewHelperTest.php:66
‪TYPO3\CMS\Fluid\Tests\Functional\ViewHelpers\Be\Menus\ActionMenuItemViewHelperTest\isRenderedDataProvider
‪isRenderedDataProvider()
Definition: ActionMenuItemViewHelperTest.php:25