[BUGFIX] Properly resolve link format to page type 54/40454/2
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:10:14 +0000 (22:10 +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/40454
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 768c7c2..d8522f9 100644 (file)
@@ -653,7 +653,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 5b088be..b31827e 100644 (file)
@@ -582,6 +582,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');
                $mockConfigurationManager->expects($this->any())->method('getConfiguration')
@@ -589,7 +590,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);