‪TYPO3CMS  10.4
AbstractCompositeValidatorTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
20 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪AbstractCompositeValidatorTest extends UnitTestCase
26 {
30  public function ‪validatorAcceptsSupportedOptions(): void
31  {
32  $inputOptions = [
33  'requiredOption' => 666,
34  'demoOption' => 42
35  ];
36  $expectedOptions = $inputOptions;
38  self::assertSame($expectedOptions, ‪$validator->getOptions());
39  }
40 
44  public function ‪validatorHasDefaultOptions(): void
45  {
46  $inputOptions = ['requiredOption' => 666];
47  $expectedOptions = [
48  'requiredOption' => 666,
49  'demoOption' => PHP_INT_MAX
50  ];
52  self::assertSame($expectedOptions, ‪$validator->getOptions());
53  }
54 
59  {
60  $inputOptions = ['invalidoption' => 42];
61  $this->expectException(InvalidValidationOptionsException::class);
62  $this->expectExceptionCode(1339079804);
63  new ‪AbstractCompositeValidatorClass($inputOptions);
64  }
65 
70  {
71  $inputOptions = [];
72  $this->expectException(InvalidValidationOptionsException::class);
73  $this->expectExceptionCode(1339163922);
74  new ‪AbstractCompositeValidatorClass($inputOptions);
75  }
76 }
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractCompositeValidatorTest
Definition: AbstractCompositeValidatorTest.php:26
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractCompositeValidatorTest\validatorAcceptsSupportedOptions
‪validatorAcceptsSupportedOptions()
Definition: AbstractCompositeValidatorTest.php:30
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractCompositeValidatorTest\validatorThrowsExceptionOnNotSupportedOptions
‪validatorThrowsExceptionOnNotSupportedOptions()
Definition: AbstractCompositeValidatorTest.php:58
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass
Definition: AbstractCompositeValidatorClass.php:25
‪$validator
‪if(isset($args['d'])) $validator
Definition: validateRstFiles.php:218
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractCompositeValidatorTest\validatorThrowsExceptionOnMissingRequiredOptions
‪validatorThrowsExceptionOnMissingRequiredOptions()
Definition: AbstractCompositeValidatorTest.php:69
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AbstractCompositeValidatorTest\validatorHasDefaultOptions
‪validatorHasDefaultOptions()
Definition: AbstractCompositeValidatorTest.php:44
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator
Definition: AbstractCompositeValidatorTest.php:16
‪TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException
Definition: InvalidValidationOptionsException.php:26