TYPO3 CMS  TYPO3_8-7
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 
22 class EmptyValidatorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
24 
29  {
30  $validator = $this->getMockBuilder(EmptyValidator::class)
31  ->setMethods(['translateErrorMessage'])
32  ->getMock();
33 
34  $input = '';
35 
36  $this->assertFalse($validator->validate($input)->hasErrors());
37  }
38 
43  {
44  $validator = $this->getMockBuilder(EmptyValidator::class)
45  ->setMethods(['translateErrorMessage'])
46  ->getMock();
47 
48  $input = null;
49 
50  $this->assertFalse($validator->validate($input)->hasErrors());
51  }
52 
57  {
58  $validator = $this->getMockBuilder(EmptyValidator::class)
59  ->setMethods(['translateErrorMessage'])
60  ->getMock();
61 
62  $input = [];
63 
64  $this->assertFalse($validator->validate($input)->hasErrors());
65  }
66 
71  {
72  $validator = $this->getMockBuilder(EmptyValidator::class)
73  ->setMethods(['translateErrorMessage'])
74  ->getMock();
75 
76  $input = 0;
77 
78  $this->assertFalse($validator->validate($input)->hasErrors());
79  }
80 
85  {
86  $validator = $this->getMockBuilder(EmptyValidator::class)
87  ->setMethods(['translateErrorMessage'])
88  ->getMock();
89 
90  $input = '0';
91 
92  $this->assertFalse($validator->validate($input)->hasErrors());
93  }
94 
99  {
100  $validator = $this->getMockBuilder(EmptyValidator::class)
101  ->setMethods(['translateErrorMessage'])
102  ->getMock();
103 
104  $input = 'hellö';
105 
106  $this->assertTrue($validator->validate($input)->hasErrors());
107  }
108 
113  {
114  $validator = $this->getMockBuilder(EmptyValidator::class)
115  ->setMethods(['translateErrorMessage'])
116  ->getMock();
117 
118  $input = ['hellö'];
119 
120  $this->assertTrue($validator->validate($input)->hasErrors());
121  }
122 }