|
|
|
@ -24,6 +24,55 @@ class EmailValidatorTest extends TestCase
|
|
|
|
|
$this->assertTrue($validator->validateValue('sam@rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('5011@gmail.com')); |
|
|
|
|
$this->assertFalse($validator->validateValue('rmcreative.ru')); |
|
|
|
|
$this->assertFalse($validator->validateValue('Carsten Brandt <mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('"Carsten Brandt" <mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('<mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('info@örtliches.de')); |
|
|
|
|
$this->assertFalse($validator->validateValue('sam@рмкреатиф.ru')); |
|
|
|
|
|
|
|
|
|
$validator->allowName = true; |
|
|
|
|
|
|
|
|
|
$this->assertTrue($validator->validateValue('sam@rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('5011@gmail.com')); |
|
|
|
|
$this->assertFalse($validator->validateValue('rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('Carsten Brandt <mail@cebe.cc>')); |
|
|
|
|
$this->assertTrue($validator->validateValue('"Carsten Brandt" <mail@cebe.cc>')); |
|
|
|
|
$this->assertTrue($validator->validateValue('<mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('info@örtliches.de')); |
|
|
|
|
$this->assertFalse($validator->validateValue('sam@рмкреатиф.ru')); |
|
|
|
|
$this->assertFalse($validator->validateValue('Informtation info@oertliches.de')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testValidateIdnValue() |
|
|
|
|
{ |
|
|
|
|
if (!extension_loaded("intl")) { |
|
|
|
|
$this->markTestSkipped("intl not installed. Skipping."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$validator = new EmailValidator(); |
|
|
|
|
$validator->enableIDN = true; |
|
|
|
|
|
|
|
|
|
$this->assertTrue($validator->validateValue('info@örtliches.de')); |
|
|
|
|
$this->assertTrue($validator->validateValue('sam@рмкреатиф.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('sam@rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('5011@gmail.com')); |
|
|
|
|
$this->assertFalse($validator->validateValue('rmcreative.ru')); |
|
|
|
|
$this->assertFalse($validator->validateValue('Carsten Brandt <mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('"Carsten Brandt" <mail@cebe.cc>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('<mail@cebe.cc>')); |
|
|
|
|
|
|
|
|
|
$validator->allowName = true; |
|
|
|
|
|
|
|
|
|
$this->assertTrue($validator->validateValue('info@örtliches.de')); |
|
|
|
|
$this->assertTrue($validator->validateValue('Informtation <info@örtliches.de>')); |
|
|
|
|
$this->assertFalse($validator->validateValue('Informtation info@örtliches.de')); |
|
|
|
|
$this->assertTrue($validator->validateValue('sam@рмкреатиф.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('sam@rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('5011@gmail.com')); |
|
|
|
|
$this->assertFalse($validator->validateValue('rmcreative.ru')); |
|
|
|
|
$this->assertTrue($validator->validateValue('Carsten Brandt <mail@cebe.cc>')); |
|
|
|
|
$this->assertTrue($validator->validateValue('"Carsten Brandt" <mail@cebe.cc>')); |
|
|
|
|
$this->assertTrue($validator->validateValue('<mail@cebe.cc>')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testValidateValueMx() |
|
|
|
|