17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
32 protected function setUp()
34 $this->widgetContext = new \TYPO3\CMS\Fluid\Core\Widget\WidgetContext();
45 $property = new \ReflectionProperty(WidgetContext::class, $name);
46 $property->setAccessible(
true);
47 $property->setValue($this->widgetContext, $value);
48 $method =
'get' . ucfirst($name);
49 $this->assertEquals($value, call_user_func_array([$this->widgetContext, $method], []));
60 $method =
'set' . ucfirst($name);
61 call_user_func_array([$this->widgetContext, $method], [$value]);
62 $this->assertAttributeEquals($value, $name, $this->widgetContext);
71 [
'parentPluginNamespace',
'foo-bar'],
72 [
'parentExtensionName',
'baz'],
73 [
'parentPluginName',
'baz-foo'],
74 [
'widgetViewHelperClassName',
'bar-foo'],
83 $this->widgetContext->setWidgetIdentifier(
'myWidgetIdentifier');
84 $this->assertEquals(
'myWidgetIdentifier', $this->widgetContext->getWidgetIdentifier());
92 $this->widgetContext->setAjaxWidgetIdentifier(42);
93 $this->assertEquals(42, $this->widgetContext->getAjaxWidgetIdentifier());
101 $this->widgetContext->setWidgetConfiguration([
'key' =>
'value']);
102 $this->assertEquals([
'key' =>
'value'], $this->widgetContext->getWidgetConfiguration());
110 $this->widgetContext->setControllerObjectName(
'Tx_Fluid_Object_Name');
111 $this->assertEquals(
'Tx_Fluid_Object_Name', $this->widgetContext->getControllerObjectName());
119 $viewHelperChildNodes = $this->createMock(\
TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode::class);
120 $renderingContext = $this->createMock(\
TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface::class);
121 $this->widgetContext->setViewHelperChildNodes($viewHelperChildNodes, $renderingContext);
122 $this->assertSame($viewHelperChildNodes, $this->widgetContext->getViewHelperChildNodes());
123 $this->assertSame($renderingContext, $this->widgetContext->getViewHelperChildNodeRenderingContext());
133 'widgetIdentifier',
'ajaxWidgetIdentifier',
'widgetConfiguration',
'controllerObjectName',
134 'parentPluginNamespace',
'parentVendorName',
'parentExtensionName',
'parentPluginName',
135 'widgetViewHelperClassName'
137 $this->widgetContext->__sleep()