Commit d9dcea33 authored by Christian Kuhn's avatar Christian Kuhn Committed by Andreas Fernandez
Browse files

[TASK] Make ContentObjectRendererTest notice free

Change-Id: Icbfa4bbc470650848b0ef22d6e4f348173c6a3ef
Resolves: #84456
Releases: master
Reviewed-on: https://review.typo3.org/57906


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 4cad2388
......@@ -847,7 +847,7 @@ class GeneralUtility
}
// @todo find out which locale is used for current BE user to cover the BE case as well
$oldLocale = setlocale(LC_NUMERIC, 0);
$newLocale = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE']->config['config']['locale_all'] : '';
$newLocale = $GLOBALS['TSFE']->config['config']['locale_all'] ?? '';
if ($newLocale) {
setlocale(LC_NUMERIC, $newLocale);
}
......@@ -1319,7 +1319,7 @@ class GeneralUtility
// There are '' around the value. We look for the next ' ' or '>'
$reg = preg_split('/[[:space:]=]/', $tag_tmp, 2);
$value[] = trim($reg[0]);
$tag_tmp = trim(substr($tag_tmp, strlen($reg[0]), 1) . $reg[1]);
$tag_tmp = trim(substr($tag_tmp, strlen($reg[0]), 1) . ($reg[1] ?? ''));
}
}
reset($value);
......
......@@ -33,7 +33,7 @@ class LoadRegisterContentObject extends AbstractContentObject
$isExecuted = [];
foreach ($conf as $theKey => $theValue) {
$register = rtrim($theKey, '.');
if (!$isExecuted[$register]) {
if (!isset($isExecuted[$register]) || !$isExecuted[$register]) {
$registerProperties = $register . '.';
if (isset($conf[$register]) && isset($conf[$registerProperties])) {
$theValue = $this->cObj->stdWrap($conf[$register], $conf[$registerProperties]);
......
......@@ -129,8 +129,9 @@ abstract class AbstractTypolinkBuilder
protected function resolveTargetAttribute(array $conf, string $name, bool $respectFrameSetOption = false, string $fallbackTarget = ''): string
{
$tsfe = $this->getTypoScriptFrontendController();
$targetAttributeAllowed = (!$respectFrameSetOption || !$tsfe->config['config']['doctype'] ||
in_array((string)$tsfe->config['config']['doctype'], ['xhtml_trans', 'xhtml_basic', 'html5'], true));
$targetAttributeAllowed = !$respectFrameSetOption
|| (!isset($tsfe->config['config']['doctype']) || !$tsfe->config['config']['doctype'])
|| in_array((string)$tsfe->config['config']['doctype'], ['xhtml_trans', 'xhtml_basic', 'html5'], true);
$target = '';
if (isset($conf[$name])) {
......
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject;
/*
......@@ -70,11 +71,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
*/
class ContentObjectRendererTest extends UnitTestCase
{
/**
* Subject is not notice free, disable E_NOTICES
*/
protected static $suppressNotices = true;
/**
* @var bool Reset singletons created by subject
*/
......@@ -129,9 +125,11 @@ class ContentObjectRendererTest extends UnitTestCase
*/
protected function setUp(): void
{
$GLOBALS['SIM_ACCESS_TIME'] = 1534278180;
$this->templateServiceMock =
$this->getMockBuilder(TemplateService::class)
->setMethods(['linkData'])->getMock();
->setMethods(['linkData'])
->getMock();
$pageRepositoryMock =
$this->getAccessibleMock(PageRepository::class, ['getRawRecord', 'getMountPointInfo']);
$this->frontendControllerMock =
......@@ -3825,7 +3823,7 @@ class ContentObjectRendererTest extends UnitTestCase
$subject
->expects($this->exactly($times))
->method('HTMLparser_TSbridge')
->with($content, $conf['HTMLparser.'])
->with($content, $conf['HTMLparser.'] ?? [])
->willReturn($will);
$this->assertSame(
$expect,
......@@ -5181,8 +5179,8 @@ class ContentObjectRendererTest extends UnitTestCase
$rteParseFunc = $this->getLibParseFunc_RTE();
$conf = [
'encapsLines' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines'],
'encapsLines.' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines.'],
'encapsLines' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines'] ?? null,
'encapsLines.' => $rteParseFunc['parseFunc.']['nonTypoTagStdWrap.']['encapsLines.'] ?? null,
];
// don't add an &nbsp; to tag without content
$conf['encapsLines.']['innerStdWrap_all.']['ifBlank'] = '';
......@@ -5867,7 +5865,7 @@ class ContentObjectRendererTest extends UnitTestCase
$subject
->expects($this->exactly($times))
->method('checkIf')
->with($conf['if.'])
->with($conf['if.'] ?? null)
->willReturn($will);
$this->assertSame($expect, $subject->stdWrap_if($content, $conf));
$this->assertSame($stop, $subject->_get('stopRendering')[1]);
......@@ -6996,7 +6994,7 @@ class ContentObjectRendererTest extends UnitTestCase
$subject
->expects($this->exactly($times))
->method('prefixComment')
->with($conf['prefixComment'], [], $content)
->with($conf['prefixComment'] ?? null, [], $content)
->willReturn($will);
$this->assertSame(
$expect,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment