From 05367768d6d8dd4de7ce504ba259a23bb9b264de Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Tue, 4 Nov 2014 09:30:34 +0100 Subject: [PATCH] improved tests for strict checking --- .../EmailValidator/EmailValidatorTest.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php b/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php index e9e3a6e..e72fde4 100644 --- a/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php +++ b/tests/egulias/Tests/EmailValidator/EmailValidatorTest.php @@ -150,6 +150,16 @@ public function testValidEmailsWithWarningsCheck($warnings, $email) $this->assertEquals($warnings, $this->validator->getWarnings()); } + /** + * @dataProvider getInvalidEmailsWithWarnings + */ + public function testInvalidEmailsWithDnsCheckAndStrictMode($warnings, $email) + { + $this->assertFalse($this->validator->isValid($email, true, true)); + + $this->assertEquals($warnings, $this->validator->getWarnings()); + } + public function getInvalidEmailsWithWarnings() { return array( @@ -301,14 +311,15 @@ public function getInvalidEmailsWithWarnings() 'parttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpart'. 'toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpar' ), + array( + array( + EmailValidator::DNSWARN_NO_RECORD, + ), + 'test@test' + ), ); } - public function testInvalidEmailsWithDNSAndStrict() - { - $this->assertFalse($this->validator->isValid('test@test', true, true)); - } - public function testInvalidEmailsWithStrict() { $this->assertFalse($this->validator->isValid('"test"@test', false, true));