‪TYPO3CMS  9.5
TypoScriptServiceTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪TypoScriptServiceTest extends UnitTestCase
25 {
30  {
31  $mockTypoScriptService = $this->getAccessibleMock(TypoScriptService::class, [
32  'getTypoScriptFrontendController'
33  ], [], '', false);
34 
35  $mockContentObjectRenderer = $this->getMockBuilder(
36  ContentObjectRenderer::class
37  )->getMock();
38 
39  $fakeTypoScriptFrontendController = new \stdClass;
40  $fakeTypoScriptFrontendController->cObj = $mockContentObjectRenderer;
41 
42  $mockContentObjectRenderer
43  ->expects($this->any())
44  ->method('cObjGetSingle')
45  ->with('TEXT', ['value' => 'rambo'])
46  ->will($this->returnValue('rambo'));
47 
48  $mockTypoScriptService
49  ->expects($this->any())
50  ->method('getTypoScriptFrontendController')
51  ->willReturn($fakeTypoScriptFrontendController);
52 
53  $input = [
54  'key.' => [
55  'john' => 'TEXT',
56  'john.' => [
57  'value' => 'rambo'
58  ],
59  ],
60  ];
61  $expected = [
62  'key' => [
63  'john' => 'rambo',
64  ],
65  ];
66 
67  $this->assertSame($expected, $mockTypoScriptService->_call('resolveTypoScriptConfiguration', $input));
68  }
69 }
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration
Definition: InheritancesResolverServiceTest.php:3
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration\TypoScriptServiceTest\resolveTypoScriptConfigurationReturnsResolvedConfiguration
‪resolveTypoScriptConfigurationReturnsResolvedConfiguration()
Definition: TypoScriptServiceTest.php:29
‪TYPO3\CMS\Form\Mvc\Configuration\TypoScriptService
Definition: TypoScriptService.php:26
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:91
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration\TypoScriptServiceTest
Definition: TypoScriptServiceTest.php:25