TYPO3 CMS  TYPO3_7-6
RenderViewHelperTest.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
18 {
22  protected $viewHelper;
23 
24  protected function setUp()
25  {
26  parent::setUp();
27  $this->templateVariableContainer = new \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer();
28  $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
29  $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\RenderViewHelper::class, ['dummy']);
30  $this->injectDependenciesIntoViewHelper($this->viewHelper);
31  }
32 
37  {
38  $arguments = [
39  'someArgument' => 'someValue'
40  ];
41  $expected = [
42  'someArgument' => 'someValue',
43  'settings' => 'theSettings'
44  ];
45  $this->templateVariableContainer->add('settings', 'theSettings');
46 
47  $actual = $this->viewHelper->_call('loadSettingsIntoArguments', $arguments, $this->renderingContext);
48  $this->assertEquals($expected, $actual);
49  }
50 
55  {
56  $arguments = [
57  'someArgument' => 'someValue',
58  'settings' => 'specifiedSettings'
59  ];
60  $expected = [
61  'someArgument' => 'someValue',
62  'settings' => 'specifiedSettings'
63  ];
64  $this->templateVariableContainer->add('settings', 'theSettings');
65 
66  $actual = $this->viewHelper->_call('loadSettingsIntoArguments', $arguments, $this->renderingContext);
67  $this->assertEquals($expected, $actual);
68  }
69 
74  {
75  $arguments = [
76  'someArgument' => 'someValue'
77  ];
78  $expected = [
79  'someArgument' => 'someValue'
80  ];
81 
82  $actual = $this->viewHelper->_call('loadSettingsIntoArguments', $arguments, $this->renderingContext);
83  $this->assertEquals($expected, $actual);
84  }
85 }
injectDependenciesIntoViewHelper(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper)
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)