[TASK] Minor cleanup ContentObjectRenderer 65/58065/2
authorBenni Mack <benni@typo3.org>
Tue, 28 Aug 2018 19:16:06 +0000 (21:16 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 28 Aug 2018 20:51:57 +0000 (22:51 +0200)
ContentObjectRenderer has some minor flaws. Also the functional tests have
some unused code.

Resolves: #86015
Releases: master
Change-Id: I9ed00b32f4c00de7b667ad72052a0b7032901313
Reviewed-on: https://review.typo3.org/58065
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php

index eb4f562..3a35309 100644 (file)
@@ -1426,7 +1426,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
     {
         $altText = isset($conf['altText.']) ? trim($this->stdWrap($conf['altText'], $conf['altText.'])) : trim($conf['altText']);
         $titleText = isset($conf['titleText.']) ? trim($this->stdWrap($conf['titleText'], $conf['titleText.'])) : trim($conf['titleText']);
-        if (isset($conf['longdescURL.']) && $this->getTypoScriptFrontendController()->config['config']['doctype'] != 'html5') {
+        if (isset($conf['longdescURL.']) && $this->getTypoScriptFrontendController()->config['config']['doctype'] !== 'html5') {
             $longDescUrl = $this->typoLink_URL($conf['longdescURL.']);
         } else {
             $longDescUrl = trim($conf['longdescURL']);
@@ -4952,7 +4952,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         //   field = backend_layout
                         //   ifEmpty.data = levelfield:-2, backend_layout_next_level, slide
                         //   ifEmpty.ifEmpty = default
-                        $retVal = $GLOBALS['TSFE']->page['backend_layout'];
+                        $retVal = $tsfe->page['backend_layout'];
 
                         // If it is set to "none" - don't use any
                         if ($retVal === '-1') {
index e6a9f19..08cc16f 100644 (file)
@@ -414,9 +414,8 @@ class ContentObjectRendererTest extends \TYPO3\TestingFramework\Core\Functional\
 
         $typoScriptFrontendController = $this->getMockBuilder(TypoScriptFrontendController::class)
             ->setConstructorArgs([null, 1, 0])
-            ->setMethods(['getDomainDataForPid'])
+            ->setMethods(['dummy'])
             ->getMock();
-        $typoScriptFrontendController->expects($this->any())->method('getDomainDataForPid')->willReturn(null);
         $typoScriptFrontendController->config = [
             'config' => [],
         ];
@@ -473,9 +472,8 @@ class ContentObjectRendererTest extends \TYPO3\TestingFramework\Core\Functional\
 
         $typoScriptFrontendController = $this->getMockBuilder(TypoScriptFrontendController::class)
             ->setConstructorArgs([null, 1, 0])
-            ->setMethods(['getDomainDataForPid'])
+            ->setMethods(['dummy'])
             ->getMock();
-        $typoScriptFrontendController->expects($this->any())->method('getDomainDataForPid')->willReturn(null);
         $typoScriptFrontendController->config = [
             'config' => [],
         ];