Skip to content
Snippets Groups Projects
Commit cf1a8900 authored by Christian Kuhn's avatar Christian Kuhn Committed by Anja Leichsenring
Browse files

[BUGFIX] Avoid incomplete mock in FluidTemplateContentObjectTest

FluidTemplateContentObject calls:
$headerAssets = $this->view->renderSection(...);
if (!empty(trim($headerAssets))) { ...

This expects that renderSection() actually returns a
string, which it usually does. Not returning a string
and then calling trim(null) emits a PHP 8.1 E_DEPRECATED
error.

The heavy mocking FluidTemplateContentObjectTest class
however misses to mock the view properly in many places
and then triggers the trim(null) deprecation since
especially renderSection() method mock is not instructed
to return string and falls back to null.

The patch takes care of proper mocking and adds a
todo these tests would benefit from being turned
into functional tests to avoid the mock party.

Change-Id: Ifc2cb6ca00f09af0c6bd850f31c8807347e8c645
Resolves: #95771
Releases: master
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71969


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarJochen <rothjochen@gmail.com>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarJochen <rothjochen@gmail.com>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent c2f7e056
Branches
Tags
No related merge requests found
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