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