TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
form/Tests/Unit/Mvc/Configuration/TypoScriptServiceTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration;
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 
20 
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 }
getAccessibleMock($originalClassName, $methods=[], array $arguments=[], $mockClassName= '', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)