‪TYPO3CMS  10.4
WidgetRequestTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪WidgetRequestTest extends UnitTestCase
26 {
31  {
32  $widgetContext = $this->getMockBuilder(WidgetContext::class)
33  ->setMethods(['getControllerObjectName'])
34  ->getMock();
35  $widgetContext->expects(self::once())->method('getControllerObjectName')->willReturn('Tx_Fluid_ControllerObjectName');
36  $widgetRequest = $this->getMockBuilder(WidgetRequest::class)
37  ->setMethods(['setControllerObjectName'])
38  ->getMock();
39  $widgetRequest->expects(self::once())->method('setControllerObjectName')->with('Tx_Fluid_ControllerObjectName');
40  $widgetRequest->setWidgetContext($widgetContext);
41  }
42 
47  {
48  $widgetContext = $this->getMockBuilder(WidgetContext::class)
49  ->setMethods(['getParentPluginNamespace', 'getWidgetIdentifier'])
50  ->getMock();
51  $widgetContext->expects(self::once())->method('getParentPluginNamespace')->willReturn('foo');
52  $widgetContext->expects(self::once())->method('getWidgetIdentifier')->willReturn('bar');
53  $widgetRequest = $this->getAccessibleMock(WidgetRequest::class, ['dummy']);
54  $widgetRequest->_set('widgetContext', $widgetContext);
55  self::assertEquals('foo[bar]', $widgetRequest->getArgumentPrefix());
56  }
57 
62  {
63  $widgetContext = $this->createMock(WidgetContext::class);
64  $widgetRequest = $this->getMockBuilder(WidgetRequest::class)
65  ->setMethods(['setControllerObjectName'])
66  ->getMock();
67  $widgetRequest->setWidgetContext($widgetContext);
68  self::assertSame($widgetContext, $widgetRequest->getWidgetContext());
69  }
70 }
‪TYPO3\CMS\Fluid\Core\Widget\WidgetRequest
Definition: WidgetRequest.php:25
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest
Definition: WidgetRequestTest.php:26
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\setWidgetContextAlsoSetsControllerObjectName
‪setWidgetContextAlsoSetsControllerObjectName()
Definition: WidgetRequestTest.php:30
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget
Definition: AbstractWidgetControllerTest.php:16
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\widgetContextCanBeReadAgain
‪widgetContextCanBeReadAgain()
Definition: WidgetRequestTest.php:61
‪TYPO3\CMS\Fluid\Core\Widget\WidgetContext
Definition: WidgetContext.php:33
‪TYPO3\CMS\Fluid\Tests\Unit\Core\Widget\WidgetRequestTest\getArgumentPrefixReadsVariablesFromWidgetContext
‪getArgumentPrefixReadsVariablesFromWidgetContext()
Definition: WidgetRequestTest.php:46