‪TYPO3CMS  10.4
ViewHelperResolverTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 class ‪ViewHelperResolverTest extends UnitTestCase
30 {
31  protected ‪$resetSingletonInstances = true;
32 
37  {
38  $objectManager = $this->prophesize(ObjectManager::class);
39  $objectManager->get('x')->willReturn(new \stdClass());
40  GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager->reveal());
41  self::assertInstanceOf(\stdClass::class, (new ‪ViewHelperResolver())->createViewHelperInstanceFromClassName('x'));
42  }
43 
51  public function ‪resolveViewHelperClassNameResolvesExpectedViewHelperClassName($namespace, $method, $expected)
52  {
53  $viewHelperResolver = new ‪ViewHelperResolver();
54  self::assertEquals($expected, $viewHelperResolver->resolveViewHelperClassName($namespace, $method));
55  }
56 
61  {
62  return [
63  ['f', 'cObject', CObjectViewHelper::class],
64  ['f', 'format.htmlentities', HtmlentitiesViewHelper::class],
65  ['f', 'render', RenderViewHelper::class]
66  ];
67  }
68 }
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper\ViewHelperResolverTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: ViewHelperResolverTest.php:31
‪TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperResolver
Definition: ViewHelperResolver.php:53
‪TYPO3\CMS\Fluid\ViewHelpers\RenderViewHelper
Definition: RenderViewHelper.php:23
‪TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper
Definition: CObjectViewHelper.php:85
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper\ViewHelperResolverTest\resolveViewHelperClassNameResolvesExpectedViewHelperClassName
‪resolveViewHelperClassNameResolvesExpectedViewHelperClassName($namespace, $method, $expected)
Definition: ViewHelperResolverTest.php:51
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper
Definition: ViewHelperResolverTest.php:16
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlentitiesViewHelper
Definition: HtmlentitiesViewHelper.php:51
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper\ViewHelperResolverTest
Definition: ViewHelperResolverTest.php:30
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper\ViewHelperResolverTest\getResolveViewHelperNameTestValues
‪array getResolveViewHelperNameTestValues()
Definition: ViewHelperResolverTest.php:60
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper\ViewHelperResolverTest\createViewHelperInstanceCreatesViewHelperInstanceUsingObjectManager
‪createViewHelperInstanceCreatesViewHelperInstanceUsingObjectManager()
Definition: ViewHelperResolverTest.php:36
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28