[BUGFIX] Properly resolve link format to page type 87/38687/4
authorDaniel Schmidt <daniel@netz-basis.com>
Tue, 14 Apr 2015 10:55:38 +0000 (12:55 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 18 Jun 2015 20:09:36 +0000 (22:09 +0200)
This fixes the resolving of link format to target page type
when creating frontend links with the UriBuilder.

Resolves: #66352
Releases: master, 6.2
Change-Id: I6bb6ec805212cd7411ecd17e4abc3ac542f7a337
Reviewed-on: http://review.typo3.org/38687
Reviewed-by: Cedric Ziel <cedric@cedric-ziel.com>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php

index 46598b6..183fb4e 100644 (file)
@@ -682,7 +682,7 @@ class UriBuilder {
                if ($this->targetPageType !== 0) {
                        $typolinkConfiguration['parameter'] .= ',' . $this->targetPageType;
                } elseif ($this->format !== '') {
-                       $targetPageType = $this->extensionService->getTargetPageTypeByFormat($this->request->getControllerExtensionKey(), $this->format);
+                       $targetPageType = $this->extensionService->getTargetPageTypeByFormat($this->request->getControllerExtensionName(), $this->format);
                        $typolinkConfiguration['parameter'] .= ',' . $targetPageType;
                }
                if (count($this->arguments) > 0) {
index 54c1cc1..5f5ce46 100644 (file)
@@ -617,6 +617,7 @@ class UriBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function buildTypolinkConfigurationResolvesPageTypeFromFormat() {
                $this->uriBuilder->setTargetPageUid(123);
                $this->uriBuilder->setFormat('txt');
+               $this->mockRequest->expects($this->once())->method('getControllerExtensionName')->will($this->returnValue('SomeExtensionNameFromRequest'));
 
                $mockConfigurationManager = $this->getMock(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
                $mockConfigurationManager->expects($this->any())->method('getConfiguration')
@@ -624,7 +625,7 @@ class UriBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->uriBuilder->_set('configurationManager', $mockConfigurationManager);
 
                $this->mockExtensionService->expects($this->any())->method('getTargetPageTypeByFormat')
-                       ->with(NULL, 'txt')
+                       ->with('SomeExtensionNameFromRequest', 'txt')
                        ->will($this->returnValue(2));
 
                $expectedConfiguration = array('parameter' => '123,2', 'useCacheHash' => 1);