Commit bf903bb6 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[BUGFIX] Avoid invalid setup in Typo3StatusTest

Let getLL() return string in tests to avoid a
"sprintf(): Passing null to parameter #1" from
Typo3Status test. Sanitize that sprintf().

Resolves: #95749
Releases: master
Change-Id: I851badd4e8f6bcdd64ba2e70d37dafcce03e905b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71952


Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7d63602e
......@@ -63,9 +63,9 @@ class Typo3Status implements StatusProviderInterface
$message .= '<ol>';
foreach ($xclassFoundArray as $originalClass => $xClassName) {
$messageDetail = sprintf(
$this->getLanguageService()->getLL('status_xclassUsageFound_message_detail'),
(string)($this->getLanguageService()->getLL('status_xclassUsageFound_message_detail')),
'<code>' . htmlspecialchars((string)$originalClass) . '</code>',
'<code>' . htmlspecialchars($xClassName) . '</code>'
'<code>' . htmlspecialchars((string)$xClassName) . '</code>'
);
$message .= '<li>' . $messageDetail . '</li>';
}
......
......@@ -17,6 +17,8 @@ declare(strict_types=1);
namespace TYPO3\CMS\Reports\Tests\Unit\Report\Status;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Reports\Report\Status\Typo3Status;
use TYPO3\CMS\Reports\Status;
......@@ -27,13 +29,17 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
*/
class Typo3StatusTest extends UnitTestCase
{
use ProphecyTrait;
/**
* Set up
*/
protected function setUp(): void
{
parent::setUp();
$GLOBALS['LANG'] = $this->createMock(LanguageService::class);
$languageServiceProphecy = $this->prophesize(LanguageService::class);
$languageServiceProphecy->getLL(Argument::any())->willReturn('');
$GLOBALS['LANG'] = $languageServiceProphecy->reveal();
}
/**
......
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