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