[CLEANUP] Rework/simplify copyright header and remove @package
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Tests / Unit / Core / Widget / WidgetContextTest.php
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Widget;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is backported from the TYPO3 Flow package "TYPO3.Fluid".
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 /**
20 * Test case
21 */
22 class WidgetContextTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
23
24 /**
25 * @var \TYPO3\CMS\Fluid\Core\Widget\WidgetContext
26 */
27 protected $widgetContext;
28
29 /**
30
31 */
32 public function setUp() {
33 $this->widgetContext = new \TYPO3\CMS\Fluid\Core\Widget\WidgetContext();
34 }
35
36 /**
37 * @test
38 */
39 public function widgetIdentifierCanBeReadAgain() {
40 $this->widgetContext->setWidgetIdentifier('myWidgetIdentifier');
41 $this->assertEquals('myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier());
42 }
43
44 /**
45 * @test
46 */
47 public function ajaxWidgetIdentifierCanBeReadAgain() {
48 $this->widgetContext->setAjaxWidgetIdentifier(42);
49 $this->assertEquals(42, $this->widgetContext->getAjaxWidgetIdentifier());
50 }
51
52 /**
53 * @test
54 */
55 public function widgetConfigurationCanBeReadAgain() {
56 $this->widgetContext->setWidgetConfiguration(array('key' => 'value'));
57 $this->assertEquals(array('key' => 'value'), $this->widgetContext->getWidgetConfiguration());
58 }
59
60 /**
61 * @test
62 */
63 public function controllerObjectNameCanBeReadAgain() {
64 $this->widgetContext->setControllerObjectName('Tx_Fluid_Object_Name');
65 $this->assertEquals('Tx_Fluid_Object_Name', $this->widgetContext->getControllerObjectName());
66 }
67
68 /**
69 * @test
70 */
71 public function viewHelperChildNodesCanBeReadAgain() {
72 $viewHelperChildNodes = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode');
73 $renderingContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContextInterface');
74 $this->widgetContext->setViewHelperChildNodes($viewHelperChildNodes, $renderingContext);
75 $this->assertSame($viewHelperChildNodes, $this->widgetContext->getViewHelperChildNodes());
76 $this->assertSame($renderingContext, $this->widgetContext->getViewHelperChildNodeRenderingContext());
77 }
78 }