‪TYPO3CMS  10.4
EmailAddressValidatorTest.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 ‪EmailAddressValidatorTest extends UnitTestCase
25 {
30  {
32  $subject = $this->getMockBuilder(EmailAddressValidator::class)
33  ->onlyMethods(['translateErrorMessage'])
34  ->getMock();
35  self::assertFalse($subject->validate('valid.email@example.com')->hasErrors());
36  }
37 
42  {
44  $subject = $this->getMockBuilder(EmailAddressValidator::class)
45  ->onlyMethods(['translateErrorMessage'])
46  ->getMock();
47  self::assertTrue($subject->validate('@typo3.org')->hasErrors());
48  }
49 
54  {
56  $subject = $this->getMockBuilder(EmailAddressValidator::class)
57  ->onlyMethods(['translateErrorMessage'])
58  ->getMock();
59  self::assertTrue($subject->validate(123)->hasErrors());
60  }
61 
66  {
68  $subject = $this->getMockBuilder(EmailAddressValidator::class)
69  ->onlyMethods(['translateErrorMessage'])
70  ->getMock();
71  self::assertCount(1, $subject->validate('someone@typo3.')->getErrors());
72  }
73 }
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\EmailAddressValidatorTest
Definition: EmailAddressValidatorTest.php:25
‪TYPO3\CMS\Extbase\Validation\Validator\EmailAddressValidator
Definition: EmailAddressValidator.php:24
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\EmailAddressValidatorTest\emailValidatorCreatesTheCorrectErrorForAnInvalidEmailAddress
‪emailValidatorCreatesTheCorrectErrorForAnInvalidEmailAddress()
Definition: EmailAddressValidatorTest.php:65
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\EmailAddressValidatorTest\emailAddressValidatorReturnsFalseForAnInvalidEmailAddress
‪emailAddressValidatorReturnsFalseForAnInvalidEmailAddress()
Definition: EmailAddressValidatorTest.php:41
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator
Definition: AbstractCompositeValidatorTest.php:16
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\EmailAddressValidatorTest\emailAddressValidatorReturnsFalseForNonStringAddress
‪emailAddressValidatorReturnsFalseForNonStringAddress()
Definition: EmailAddressValidatorTest.php:53
‪TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\EmailAddressValidatorTest\emailAddressValidatorReturnsNoErrorsForAValidEmailAddress
‪emailAddressValidatorReturnsNoErrorsForAValidEmailAddress()
Definition: EmailAddressValidatorTest.php:29