[BUGFIX] Fluid must not use legacy flash message handling
authorAlexander Schnitzler <alex.schnitzler@typovision.de>
Sun, 14 Apr 2013 11:23:42 +0000 (13:23 +0200)
committerAlexander Schnitzler <typo3@alexanderschnitzler.de>
Mon, 15 Apr 2013 21:27:32 +0000 (23:27 +0200)
Since the core introduced a new flash message handling the
handling in Fluid has to be adjusted as well.

Releases: 6.1
Resolves: #47214
Change-Id: I490f77687befa1a62db0718f828fce1e68ebdfff
Reviewed-on: https://review.typo3.org/19972
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler
typo3/sysext/fluid/Classes/View/StandaloneView.php
typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php

index 716de3b..d9de7be 100644 (file)
@@ -86,9 +86,6 @@ class StandaloneView extends \TYPO3\CMS\Fluid\View\AbstractTemplateView {
                $controllerContext = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext');
                $controllerContext->setRequest($request);
                $controllerContext->setUriBuilder($uriBuilder);
-               $flashMessageContainer = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessageContainer');
-               // singleton
-               $controllerContext->setFlashMessageContainer($flashMessageContainer);
                $this->setControllerContext($controllerContext);
                $this->templateCompiler = $this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\Compiler\\TemplateCompiler');
                // singleton
@@ -397,4 +394,4 @@ class StandaloneView extends \TYPO3\CMS\Fluid\View\AbstractTemplateView {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 1d6d504..8b8045d 100644 (file)
@@ -106,7 +106,7 @@ class FlashMessagesViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractT
         * @api
         */
        public function render($renderMode = self::RENDER_MODE_UL) {
-               $flashMessages = $this->controllerContext->getFlashMessageContainer()->getAllMessagesAndFlush();
+               $flashMessages = $this->controllerContext->getFlashMessageQueue()->getAllMessagesAndFlush();
                if ($flashMessages === NULL || count($flashMessages) === 0) {
                        return '';
                }
index 159ab2c..fd11c2b 100644 (file)
@@ -224,14 +224,6 @@ class StandaloneViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
         * @test
-        */
-       public function constructorInjectsFlashMessageContainerToControllerContext() {
-               $this->mockControllerContext->expects($this->once())->method('setFlashMessageContainer')->with($this->mockFlashMessageContainer);
-               new \TYPO3\CMS\Fluid\View\StandaloneView();
-       }
-
-       /**
-        * @test
         * @expectedException \TYPO3\CMS\Fluid\View\Exception\InvalidTemplateResourceException
         */
        public function renderThrowsExceptionIfTemplateIsNotSpecified() {
@@ -448,4 +440,4 @@ class StandaloneViewTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 4992df6..3b2a9c9 100644 (file)
@@ -19,16 +19,11 @@ require_once(__DIR__ . '/ViewHelperBaseTestcase.php');
 class FlashMessagesViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase {
 
        /**
-        * @var \TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper
+        * @var \TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper| \PHPUnit_Framework_MockObject_MockObject |\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
         */
        protected $viewHelper;
 
        /**
-        * @var \TYPO3\CMS\Extbase\Mvc\Controller\FlashMessageContainer
-        */
-       protected $mockFlashMessageContainer;
-
-       /**
         * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder
         */
        protected $mockTagBuilder;
@@ -39,9 +34,8 @@ class FlashMessagesViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelper
         * @return void
         */
        public function setUp() {
-               $this->mockFlashMessageContainer = $this->getMock('\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessageContainer');
                $mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE);
-               $mockControllerContext->expects($this->any())->method('getFlashMessageContainer')->will($this->returnValue($this->mockFlashMessageContainer));
+               $mockControllerContext->expects($this->any())->method('getFlashMessageQueue')->will($this->returnValue(new \TYPO3\CMS\Core\Messaging\FlashMessageQueue('foo')));
 
                $this->mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder');
                $this->viewHelper = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\FlashMessagesViewHelper', array('dummy'));
@@ -58,4 +52,4 @@ class FlashMessagesViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelper
        }
 }
 
-?>
\ No newline at end of file
+?>