‪TYPO3CMS  11.5
ArrayFormFactoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Prophecy\Argument;
21 use Prophecy\PhpUnit\ProphecyTrait;
26 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
27 
28 class ‪ArrayFormFactoryTest extends UnitTestCase
29 {
30  use ProphecyTrait;
31 
36  {
37  $this->expectException(IdentifierNotValidException::class);
38  $this->expectExceptionCode(1329289436);
39 
40  $section = new ‪Section('test', 'page');
41  $arrayFormFactory = $this->getAccessibleMock(ArrayFormFactory::class, ['dummy']);
42 
43  $arrayFormFactory->_call('addNestedRenderable', [], $section);
44  }
45 
50  {
51  $unknownElement = new ‪UnknownFormElement('test-2', 'test');
52  $section = $this->prophesize(Section::class);
53  $section->createElement(Argument::cetera())->willReturn($unknownElement);
54  $configuration = [
55  'identifier' => 'test-3',
56  'type' => 'Foo',
57  ];
58  $arrayFormFactory = $this->getAccessibleMock(ArrayFormFactory::class, ['dummy']);
59  $result = $arrayFormFactory->_call('addNestedRenderable', $configuration, $section->reveal());
60  self::assertSame($unknownElement, $result);
61  }
62 }
‪TYPO3\CMS\Form\Domain\Factory\ArrayFormFactory
Definition: ArrayFormFactory.php:39
‪TYPO3\CMS\Form\Tests\Unit\Domain\Factory\ArrayFormFactoryTest\addNestedRenderableSkipChildElementRenderingIfCompositeElementIsUnknown
‪addNestedRenderableSkipChildElementRenderingIfCompositeElementIsUnknown()
Definition: ArrayFormFactoryTest.php:48
‪TYPO3\CMS\Form\Domain\Exception\IdentifierNotValidException
Definition: IdentifierNotValidException.php:30
‪TYPO3\CMS\Form\Domain\Model\FormElements\Section
Definition: Section.php:39
‪TYPO3\CMS\Form\Tests\Unit\Domain\Factory
Definition: ArrayFormFactoryTest.php:18
‪TYPO3\CMS\Form\Tests\Unit\Domain\Factory\ArrayFormFactoryTest
Definition: ArrayFormFactoryTest.php:29
‪TYPO3\CMS\Form\Domain\Model\FormElements\UnknownFormElement
Definition: UnknownFormElement.php:34
‪TYPO3\CMS\Form\Tests\Unit\Domain\Factory\ArrayFormFactoryTest\addNestedRenderableThrowsExceptionIfIdentifierIsMissing
‪addNestedRenderableThrowsExceptionIfIdentifierIsMissing()
Definition: ArrayFormFactoryTest.php:34