Add a test to prevent future regressions
This commit is contained in:
parent
6f24b05467
commit
d973eb1f7d
@ -159,4 +159,32 @@ class EmailValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
|
|
||||||
$this->assertNoViolation();
|
$this->assertNoViolation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCheckTypes()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('checkMX', Email::MX_CHECK_FAILED_ERROR),
|
||||||
|
array('checkHost', Email::HOST_CHECK_FAILED_ERROR),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getCheckTypes
|
||||||
|
*/
|
||||||
|
public function testEmptyHostIsNotValid($checkType, $violation)
|
||||||
|
{
|
||||||
|
$this->validator->validate(
|
||||||
|
'foo@bar.fr@',
|
||||||
|
new Email(array(
|
||||||
|
'message' => 'myMessage',
|
||||||
|
$checkType => true,
|
||||||
|
))
|
||||||
|
);
|
||||||
|
|
||||||
|
$this
|
||||||
|
->buildViolation('myMessage')
|
||||||
|
->setParameter('{{ value }}', '"foo@bar.fr@"')
|
||||||
|
->setCode($violation)
|
||||||
|
->assertRaised();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user