‪TYPO3CMS  10.4
EmptyValidatorTest.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 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪EmptyValidatorTest extends UnitTestCase
25 {
26 
31  {
32  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
33  ->setMethods(['translateErrorMessage'])
34  ->getMock();
35 
36  $input = '';
37 
38  self::assertFalse(‪$validator->validate($input)->hasErrors());
39  }
40 
45  {
46  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
47  ->setMethods(['translateErrorMessage'])
48  ->getMock();
49 
50  $input = null;
51 
52  self::assertFalse(‪$validator->validate($input)->hasErrors());
53  }
54 
59  {
60  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
61  ->setMethods(['translateErrorMessage'])
62  ->getMock();
63 
64  $input = [];
65 
66  self::assertFalse(‪$validator->validate($input)->hasErrors());
67  }
68 
73  {
74  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
75  ->setMethods(['translateErrorMessage'])
76  ->getMock();
77 
78  $input = 0;
79 
80  self::assertFalse(‪$validator->validate($input)->hasErrors());
81  }
82 
87  {
88  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
89  ->setMethods(['translateErrorMessage'])
90  ->getMock();
91 
92  $input = '0';
93 
94  self::assertFalse(‪$validator->validate($input)->hasErrors());
95  }
96 
101  {
102  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
103  ->setMethods(['translateErrorMessage'])
104  ->getMock();
105 
106  $input = 'hellö';
107 
108  self::assertTrue(‪$validator->validate($input)->hasErrors());
109  }
110 
115  {
116  ‪$validator = $this->getMockBuilder(EmptyValidator::class)
117  ->setMethods(['translateErrorMessage'])
118  ->getMock();
119 
120  $input = ['hellö'];
121 
122  self::assertTrue(‪$validator->validate($input)->hasErrors());
123  }
124 }
‪TYPO3\CMS\Form\Mvc\Validation\EmptyValidator
Definition: EmptyValidator.php:28
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsFalseIfInputIsNull
‪EmptyValidatorReturnsFalseIfInputIsNull()
Definition: EmptyValidatorTest.php:44
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation
Definition: CountValidatorTest.php:16
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsFalseIfInputIsZero
‪EmptyValidatorReturnsFalseIfInputIsZero()
Definition: EmptyValidatorTest.php:72
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsTrueIfInputIsNonEmptyString
‪EmptyValidatorReturnsTrueIfInputIsNonEmptyString()
Definition: EmptyValidatorTest.php:100
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsTrueIfInputIsNonEmptyArray
‪EmptyValidatorReturnsTrueIfInputIsNonEmptyArray()
Definition: EmptyValidatorTest.php:114
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest
Definition: EmptyValidatorTest.php:25
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsFalseIfInputIsEmptyArray
‪EmptyValidatorReturnsFalseIfInputIsEmptyArray()
Definition: EmptyValidatorTest.php:58
‪$validator
‪if(isset($args['d'])) $validator
Definition: validateRstFiles.php:218
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsFalseIfInputIsEmptyString
‪EmptyValidatorReturnsFalseIfInputIsEmptyString()
Definition: EmptyValidatorTest.php:30
‪TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\EmptyValidatorTest\EmptyValidatorReturnsFalseIfInputIsZeroAsString
‪EmptyValidatorReturnsFalseIfInputIsZeroAsString()
Definition: EmptyValidatorTest.php:86