‪TYPO3CMS  ‪main
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 
20 use PHPUnit\Framework\Attributes\Test;
28 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
29 
30 final class ‪AbstractRenderableTest extends FunctionalTestCase
31 {
32  protected array ‪$coreExtensionsToLoad = [
33  'form',
34  ];
35 
37 
38  protected function ‪setUp(): void
39  {
40  parent::setUp();
41  $request = (new ‪ServerRequest())->withAttribute('applicationType', ‪SystemEnvironmentBuilder::REQUESTTYPE_BE);
42  ‪$GLOBALS['TYPO3_REQUEST'] = $request;
43  $this->subject = $this->‪buildAbstractRenderable();
44  }
45 
46  #[Test]
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\Core\Core\SystemEnvironmentBuilder
Definition: SystemEnvironmentBuilder.php:41
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_BE
‪const REQUESTTYPE_BE
Definition: SystemEnvironmentBuilder.php:45
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable
Definition: AbstractRenderable.php:42
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest
Definition: AbstractRenderableTest.php:31
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\$subject
‪AbstractRenderable $subject
Definition: AbstractRenderableTest.php:36
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\buildAbstractRenderable
‪buildAbstractRenderable()
Definition: AbstractRenderableTest.php:61
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: AbstractRenderableTest.php:32
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setIdentifier
‪setIdentifier(string $identifier)
Definition: AbstractRenderable.php:114
‪TYPO3\CMS\Core\Http\ServerRequest
Definition: ServerRequest.php:39
‪TYPO3\CMS\Form\Domain\Configuration\ConfigurationService
Definition: ConfigurationService.php:50
‪TYPO3\CMS\Form\Domain\Model\FormDefinition
Definition: FormDefinition.php:224
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\setOptionsResetsValidatorsIfDefined
‪setOptionsResetsValidatorsIfDefined()
Definition: AbstractRenderableTest.php:47
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Form\Tests\Functional\Domain\Model\Renderable\AbstractRenderableTest\setUp
‪setUp()
Definition: AbstractRenderableTest.php:38
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setParentRenderable
‪setParentRenderable(CompositeRenderableInterface $parentRenderable)
Definition: AbstractRenderable.php:275
‪TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:29