‪TYPO3CMS  10.4
AlphanumericValidatorTest.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 ‪AlphanumericValidatorTest extends UnitTestCase
25 {
30  {
32  $subject = $this->getMockBuilder(AlphanumericValidator::class)
33  ->setMethods(['translateErrorMessage'])
34  ->getMock();
35  self::assertFalse($subject->validate('12ssDF34daweidf')->hasErrors());
36  }
37 
42  {
44  $subject = $this->getMockBuilder(AlphanumericValidator::class)
45  ->setMethods(['translateErrorMessage'])
46  ->getMock();
47  self::assertTrue($subject->validate('adsf%&/$jklsfdö')->hasErrors());
48  }
49 
54  {
56  $subject = $this->getMockBuilder(AlphanumericValidator::class)
57  ->setMethods(['translateErrorMessage'])
58  ->getMock();
59  self::assertEquals(1, count($subject->validate('adsf%&/$jklsfdö')->getErrors()));
60  }
61 
66  {
68  $subject = $this->getMockBuilder(AlphanumericValidator::class)
69  ->setMethods(['translateErrorMessage'])
70  ->getMock();
71  self::assertFalse($subject->validate('12ssDF34daweidfäøüößØœ你好')->hasErrors());
72  }
73 }
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericUnicodeString
‪alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericUnicodeString()
Definition: AlphanumericValidatorTest.php:65
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorReturnsErrorsForAStringWithSpecialCharacters
‪alphanumericValidatorReturnsErrorsForAStringWithSpecialCharacters()
Definition: AlphanumericValidatorTest.php:41
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorCreatesTheCorrectErrorForAnInvalidSubject
‪alphanumericValidatorCreatesTheCorrectErrorForAnInvalidSubject()
Definition: AlphanumericValidatorTest.php:53
‪TYPO3\CMS\Extbase\Validation\Validator\AlphanumericValidator
Definition: AlphanumericValidator.php:22
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest\alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericString
‪alphanumericValidatorShouldReturnNoErrorsForAnAlphanumericString()
Definition: AlphanumericValidatorTest.php:29
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\AlphanumericValidatorTest
Definition: AlphanumericValidatorTest.php:25
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator
Definition: AbstractCompositeValidatorTest.php:16