Skip to content

Commit

Permalink
improved tests for strict checking
Browse files Browse the repository at this point in the history
  • Loading branch information
craue committed Nov 4, 2014
1 parent 5c3a792 commit 0536776
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/egulias/Tests/EmailValidator/EmailValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 0536776

Please sign in to comment.