[BUGFIX] Fix Widget support
authorBastian Waidelich <bastian@typo3.org>
Thu, 30 Jun 2011 14:47:56 +0000 (16:47 +0200)
committerBastian Waidelich <bastian@typo3.org>
Thu, 30 Jun 2011 14:47:56 +0000 (16:47 +0200)
This is a hotfix for the broken widget support (see #27783)
Besides it fixes some unit tests that were red since the
PropertyMapper backport

Change-Id: I28e3dea2ce51df419ffe563c33b7ef2abb4b3027
Resolves: #27783

typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/AbstractFormFieldViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php

index a713749..2e50047 100644 (file)
@@ -219,7 +219,7 @@ abstract class Tx_Fluid_Core_Widget_AbstractWidgetViewHelper extends Tx_Fluid_Co
                } else {
                        $widgetCounter = $this->viewHelperVariableContainer->get('Tx_Fluid_Core_Widget_AbstractWidgetViewHelper', 'nextWidgetNumber');
                }
-               $widgetIdentifier = '__widget_' . $widgetCounter;
+               $widgetIdentifier = '@widget_' . $widgetCounter;
                $this->viewHelperVariableContainer->addOrUpdate('Tx_Fluid_Core_Widget_AbstractWidgetViewHelper', 'nextWidgetNumber', $widgetCounter + 1);
 
                $this->widgetContext->setWidgetIdentifier($widgetIdentifier);
index 7921f03..3a8babf 100644 (file)
@@ -118,7 +118,7 @@ class Tx_Fluid_Tests_Unit_Core_Widget_AbstractWidgetViewHelperTest extends Tx_Ex
                $this->viewHelper->expects($this->once())->method('getWidgetConfiguration')->will($this->returnValue('Some Widget Configuration'));
                $this->widgetContext->expects($this->once())->method('setWidgetConfiguration')->with('Some Widget Configuration');
 
-               $this->widgetContext->expects($this->once())->method('setWidgetIdentifier')->with('__widget_0');
+               $this->widgetContext->expects($this->once())->method('setWidgetIdentifier')->with('@widget_0');
 
                $this->viewHelper->_set('controller', new stdClass());
                $this->widgetContext->expects($this->once())->method('setControllerObjectName')->with('stdClass');
index e49501e..7d87808 100644 (file)
@@ -44,6 +44,8 @@ class Tx_Fluid_Tests_Unit_ViewHelpers_Form_AbstractFormFieldViewHelperTest exten
                        public function __clone() {}
                }');
                $object = $this->getMock($fullClassName);
+               $mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManagerInterface');
+               $object->injectConfigurationManager($mockConfigurationManager);
                $object->expects($this->any())->method('FLOW3_Persistence_isNew')->will($this->returnValue(FALSE));
 
                $formViewHelper = $this->getAccessibleMock('Tx_Fluid_ViewHelpers_Form_AbstractFormFieldViewHelper', array('dummy'), array(), '', FALSE);
index 9d650e9..949e905 100644 (file)
@@ -65,6 +65,11 @@ abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Te
        protected $renderingContext;
 
        /**
+        * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
+        */
+       protected $configurationManager;
+
+       /**
         * @return void
         * @author Sebastian Kurf├╝rst <sebastian@typo3.org>
         */
@@ -91,6 +96,7 @@ abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Te
                $this->tagBuilder = $this->getMock('Tx_Fluid_Core_ViewHelper_TagBuilder');
                $this->arguments = $this->getMock('Tx_Fluid_Core_ViewHelper_Arguments', array(), array(), '', FALSE);
                $this->renderingContext = $this->getMock('Tx_Fluid_Core_Rendering_RenderingContext');
+               $this->configurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManagerInterface');
        }
 
        /**
@@ -107,6 +113,10 @@ abstract class Tx_Fluid_ViewHelpers_ViewHelperBaseTestcase extends Tx_Extbase_Te
                if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper) {
                        $viewHelper->injectTagBuilder($this->tagBuilder);
                }
+               if ($viewHelper instanceof Tx_Fluid_ViewHelpers_Form_AbstractFormFieldViewHelper
+                       || $viewHelper instanceof Tx_Fluid_ViewHelpers_FormViewHelper) {
+                       $viewHelper->injectConfigurationManager($this->configurationManager);
+               }
        }
 }
 ?>
\ No newline at end of file