diff --git a/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php b/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php index 09a927eed0f3513772f7fd300ffc5b7d89405395..ca68d4353982461889b0fa2660011f96c92abfbb 100644 --- a/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php +++ b/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php @@ -238,9 +238,12 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext */ public function setControllerAction($action) { - $action = lcfirst(pathinfo($action, PATHINFO_FILENAME)); + $dotPosition = strpos($action, '.'); + if ($dotPosition !== false) { + $action = substr($action, 0, $dotPosition); + } parent::setControllerAction($action); - $this->controllerContext->getRequest()->setControllerActionName($action); + $this->controllerContext->getRequest()->setControllerActionName(lcfirst($action)); } /** diff --git a/typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php b/typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php index 005244d9dac19cfb57e4b263f7772ea41e26221c..afb6326d8dc98229fee6429b2c0a3aa535ee40f0 100644 --- a/typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php +++ b/typo3/sysext/fluid/Tests/Unit/Core/Rendering/RenderingContextTest.php @@ -98,4 +98,38 @@ class RenderingContextTest extends \TYPO3\CMS\Components\TestingFramework\Core\U $this->renderingContext->_set('viewHelperVariableContainer', $viewHelperVariableContainer); $this->assertSame($viewHelperVariableContainer, $this->renderingContext->getViewHelperVariableContainer()); } + + /** + * @test + * @dataProvider getControllerActionTestValues + * @param string $input + * @param string $expected + */ + public function setControllerActionProcessesInputCorrectly($input, $expected) + { + $subject = new RenderingContextFixture(); + $request = $this->getMockBuilder(Request::class)->setMethods(['setControllerActionName'])->getMock(); + $request->expects($this->at(0))->method('setControllerActionName')->with('index'); + $request->expects($this->at(1))->method('setControllerActionName')->with(lcfirst($expected)); + $controllerContext = $this->getMockBuilder(ControllerContext::class)->setMethods(['getRequest'])->getMock(); + $controllerContext->expects($this->atLeastOnce())->method('getRequest')->willReturn($request); + $subject->setControllerContext($controllerContext); + $subject->setControllerAction($input); + $this->assertAttributeSame($expected, 'controllerAction', $subject); + } + + /** + * @return array + */ + public function getControllerActionTestValues() + { + return [ + ['default', 'default'], + ['default.html', 'default'], + ['default.sub.html', 'default'], + ['Sub/Default', 'Sub/Default'], + ['Sub/Default.html', 'Sub/Default'], + ['Sub/Default.sub.html', 'Sub/Default'] + ]; + } }