‪TYPO3CMS  11.5
AbstractRenderableTest.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 
25 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
26 
27 final class ‪AbstractRenderableTest extends FunctionalTestCase
28 {
30  'form',
31  ];
32 
36  protected ‪$subject;
37 
38  protected function ‪setUp(): void
39  {
40  parent::setUp();
41  $this->subject = $this->‪buildAbstractRenderable();
42  }
43 
47  public function ‪setOptionsResetsValidatorsIfDefined(): void
48  {
49  $this->subject->setOptions(['validators' => [
50  ['identifier' => 'NotEmpty'],
51  ['identifier' => 'EmailAddress'],
52  ]]);
53 
54  self::assertSame(2, $this->subject->getValidators()->count());
55 
56  $this->subject->setOptions(['validators' => []], true);
57 
58  self::assertSame(0, $this->subject->getValidators()->count());
59  }
60 
62  {
63  $configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
64  $configurationService = GeneralUtility::makeInstance(ConfigurationService::class, $configurationManager);
65  $prototypeConfiguration = $configurationService->getPrototypeConfiguration('standard');
66 
67  ‪$subject = new class () extends ‪AbstractRenderable {};
69  ‪$subject->‪setParentRenderable(new ‪FormDefinition('foo', $prototypeConfiguration));
70 
71  return ‪$subject;
72  }
73 }
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable
Definition: AbstractRenderableTest.php:18
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable
Definition: AbstractRenderable.php:41
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest
Definition: AbstractRenderableTest.php:28
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\$subject
‪AbstractRenderable $subject
Definition: AbstractRenderableTest.php:35
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\buildAbstractRenderable
‪buildAbstractRenderable()
Definition: AbstractRenderableTest.php:60
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\$coreExtensionsToLoad
‪$coreExtensionsToLoad
Definition: AbstractRenderableTest.php:29
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setIdentifier
‪setIdentifier(string $identifier)
Definition: AbstractRenderable.php:117
‪TYPO3\CMS\Form\Domain\Configuration\ConfigurationService
Definition: ConfigurationService.php:50
‪TYPO3\CMS\Form\Domain\Model\FormDefinition
Definition: FormDefinition.php:226
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\setOptionsResetsValidatorsIfDefined
‪setOptionsResetsValidatorsIfDefined()
Definition: AbstractRenderableTest.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\setUp
‪setUp()
Definition: AbstractRenderableTest.php:37
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setParentRenderable
‪setParentRenderable(CompositeRenderableInterface $parentRenderable)
Definition: AbstractRenderable.php:307
‪TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:29