‪TYPO3CMS  9.5
AlphanumericValidatorTest.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 
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪AlphanumericValidatorTest extends UnitTestCase
23 {
28  {
30  $subject = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Validation\Validator\AlphanumericValidator::class)
31  ->setMethods(['translateErrorMessage'])
32  ->getMock();
33  $this->assertFalse($subject->validate('12ssDF34daweidf')->hasErrors());
34  }
35 
40  {
42  $subject = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Validation\Validator\AlphanumericValidator::class)
43  ->setMethods(['translateErrorMessage'])
44  ->getMock();
45  $this->assertTrue($subject->validate('adsf%&/$jklsfdö')->hasErrors());
46  }
47 
52  {
54  $subject = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Validation\Validator\AlphanumericValidator::class)
55  ->setMethods(['translateErrorMessage'])
56  ->getMock();
57  $this->assertEquals(1, count($subject->validate('adsf%&/$jklsfdö')->getErrors()));
58  }
59 
64  {
66  $subject = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Validation\Validator\AlphanumericValidator::class)
67  ->setMethods(['translateErrorMessage'])
68  ->getMock();
69  $this->assertFalse($subject->validate('12ssDF34daweidfäøüößØœ你好')->hasErrors());
70  }
71 }
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericUnicodeString
‪alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericUnicodeString()
Definition: AlphanumericValidatorTest.php:63
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorReturnsErrorsForAStringWithSpecialCharacters
‪alphanumericValidatorReturnsErrorsForAStringWithSpecialCharacters()
Definition: AlphanumericValidatorTest.php:39
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorCreatesTheCorrectErrorForAnInvalidSubject
‪alphanumericValidatorCreatesTheCorrectErrorForAnInvalidSubject()
Definition: AlphanumericValidatorTest.php:51
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericString
‪alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericString()
Definition: AlphanumericValidatorTest.php:27
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest
Definition: AlphanumericValidatorTest.php:23
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator
Definition: AbstractCompositeValidatorTest.php:2