‪TYPO3CMS  9.5
WidgetRequestTest.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 
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪WidgetRequestTest extends UnitTestCase
23 {
28  {
29  $widgetContext = $this->getMockBuilder(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetContext::class)
30  ->setMethods(['getControllerObjectName'])
31  ->getMock();
32  $widgetContext->expects($this->once())->method('getControllerObjectName')->will($this->returnValue('Tx_Fluid_ControllerObjectName'));
33  $widgetRequest = $this->getMockBuilder(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class)
34  ->setMethods(['setControllerObjectName'])
35  ->getMock();
36  $widgetRequest->expects($this->once())->method('setControllerObjectName')->with('Tx_Fluid_ControllerObjectName');
37  $widgetRequest->setWidgetContext($widgetContext);
38  }
39 
44  {
45  $widgetContext = $this->getMockBuilder(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetContext::class)
46  ->setMethods(['getParentPluginNamespace', 'getWidgetIdentifier'])
47  ->getMock();
48  $widgetContext->expects($this->once())->method('getParentPluginNamespace')->will($this->returnValue('foo'));
49  $widgetContext->expects($this->once())->method('getWidgetIdentifier')->will($this->returnValue('bar'));
50  $widgetRequest = $this->getAccessibleMock(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class, ['dummy']);
51  $widgetRequest->_set('widgetContext', $widgetContext);
52  $this->assertEquals('foo[bar]', $widgetRequest->getArgumentPrefix());
53  }
54 
59  {
60  $widgetContext = $this->createMock(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetContext::class);
61  $widgetRequest = $this->getMockBuilder(\‪TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class)
62  ->setMethods(['setControllerObjectName'])
63  ->getMock();
64  $widgetRequest->setWidgetContext($widgetContext);
65  $this->assertSame($widgetContext, $widgetRequest->getWidgetContext());
66  }
67 }
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest
Definition: WidgetRequestTest.php:23
‪TYPO3
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\setWidgetContextAlsoSetsControllerObjectName
‪setWidgetContextAlsoSetsControllerObjectName()
Definition: WidgetRequestTest.php:27
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget
Definition: AbstractWidgetControllerTest.php:2
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\widgetContextCanBeReadAgain
‪widgetContextCanBeReadAgain()
Definition: WidgetRequestTest.php:58
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\getArgumentPrefixReadsVariablesFromWidgetContext
‪getArgumentPrefixReadsVariablesFromWidgetContext()
Definition: WidgetRequestTest.php:43