TYPO3 CMS  TYPO3_7-6
AlphabeticValidatorTest.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 
21 {
25  protected $subjectClassName = \TYPO3\CMS\Form\Domain\Validator\AlphabeticValidator::class;
26 
31  {
32  return [
33  'ascii without spaces' => ['thisismyinput'],
34  'accents without spaces' => ['éóéàèò'],
35  'umlauts without spaces' => ['üöä'],
36  'empty string' => ['']
37  ];
38  }
39 
44  {
45  return [
46  'ascii with spaces' => ['This is my input'],
47  'accents with spaces' => ['Sigur Rós'],
48  'umlauts with spaces' => ['Hürriyet Daily News'],
49  'space' => [' '],
50  'empty string' => ['']
51  ];
52  }
53 
58  {
59  return [
60  'ascii with dash' => ['my-name'],
61  'accents with underscore' => ['Sigur_Rós'],
62  'umlauts with periods' => ['Hürriyet.Daily.News'],
63  'space' => [' '],
64  ];
65  }
66 
71  {
72  return [
73  'ascii with spaces and dashes' => ['This is my-name'],
74  'accents with spaces and underscores' => ['Listen to Sigur_Rós_Band'],
75  'umlauts with spaces and periods' => ['Go get the Hürriyet.Daily.News']
76  ];
77  }
78 
85  {
86  $options = ['element' => uniqid('test'), 'errorMessage' => uniqid('error')];
87  $subject = $this->createSubject($options);
88 
89  $this->assertEmpty(
90  $subject->validate($input)->getErrors()
91  );
92  }
93 
100  {
101  $options = ['element' => uniqid('test'), 'errorMessage' => uniqid('error'), 'allowWhiteSpace' => true];
102  $subject = $this->createSubject($options);
103 
104  $this->assertEmpty(
105  $subject->validate($input)->getErrors()
106  );
107  }
108 
115  {
116  $options = ['element' => uniqid('test'), 'errorMessage' => uniqid('error')];
117  $subject = $this->createSubject($options);
118 
119  $this->assertNotEmpty(
120  $subject->validate($input)->getErrors()
121  );
122  }
123 
130  {
131  $options = ['element' => uniqid('test'), 'errorMessage' => uniqid('error'), 'allowWhiteSpace' => true];
132  $subject = $this->createSubject($options);
133 
134  $this->assertNotEmpty(
135  $subject->validate($input)->getErrors()
136  );
137  }
138 }