Commit 457957da authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[BUGFIX] Fix PHP 8.2 issue

Prophecy has a minor PHP 8.2 issue as reported
with https://github.com/phpspec/prophecy/issues/555

This seems to be triggered by willBeConstructedWith()
when SuT has constructors in its inheritance chain.

Luckily, we can simplify the test a bit and
circumvent the issue for now.

Change-Id: I6e50de3345b5d27ec3e46fe78c4855a7a0fb7d43
Resolves: #98028
Releases: main, 11.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75296

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 285a0477
......@@ -18,18 +18,17 @@ declare(strict_types=1);
namespace TYPO3\CMS\Form\Tests\Unit\Domain\Factory;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Form\Domain\Exception\IdentifierNotValidException;
use TYPO3\CMS\Form\Domain\Factory\ArrayFormFactory;
use TYPO3\CMS\Form\Domain\Model\FormElements\Section;
use TYPO3\CMS\Form\Domain\Model\FormElements\UnknownFormElement;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Test case
*/
class ArrayFormFactoryTest extends UnitTestCase
{
use \Prophecy\PhpUnit\ProphecyTrait;
use ProphecyTrait;
/**
* @test
*/
......@@ -50,29 +49,14 @@ class ArrayFormFactoryTest extends UnitTestCase
public function addNestedRenderableSkipChildElementRenderingIfCompositeElementIsUnknown(): void
{
$unknownElement = new UnknownFormElement('test-2', 'test');
$section = $this->prophesize(Section::class);
$section->willBeConstructedWith(['test-1', 'Section']);
$section->createElement(Argument::cetera())->willReturn($unknownElement);
$arrayFormFactory = $this->getAccessibleMock(ArrayFormFactory::class, ['dummy']);
$configuration = [
'identifier' => 'test-3',
'type' => 'Foo',
'renderables' => [
0 => [
'identifier' => 'test-4',
],
],
];
$typeErrorExists = false;
try {
$arrayFormFactory->_call('addNestedRenderable', $configuration, $section->reveal());
} catch (\TypeError $error) {
$typeErrorExists = true;
}
self::assertFalse($typeErrorExists);
$arrayFormFactory = $this->getAccessibleMock(ArrayFormFactory::class, ['dummy']);
$result = $arrayFormFactory->_call('addNestedRenderable', $configuration, $section->reveal());
self::assertSame($unknownElement, $result);
}
}
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