Skip to content

Commit 450ed85

Browse files
committed
Additional tests for DateTimeValidator, EmailValidator and UrlValidator
1 parent f1b955b commit 450ed85

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

tests/Symfony/Tests/Component/Validator/Constraints/DateTimeValidatorTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public function testEmptyStringIsValid()
3333
$this->assertTrue($this->validator->isValid('', new DateTime()));
3434
}
3535

36+
public function testDateTimeClassIsValid()
37+
{
38+
$this->assertTrue($this->validator->isValid(new \DateTime(), new DateTime()));
39+
}
40+
3641
public function testExpectsStringCompatibleType()
3742
{
3843
$this->setExpectedException('Symfony\Component\Validator\Exception\UnexpectedTypeException');

tests/Symfony/Tests/Component/Validator/Constraints/EmailValidatorTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ public function testValidEmails($email)
4848
$this->assertTrue($this->validator->isValid($email, new Email()));
4949
}
5050

51+
/**
52+
* @dataProvider getValidEmails
53+
*/
54+
public function testValidEmailsAndCheckMX($email)
55+
{
56+
$validator = new EmailValidator();
57+
$validator->checkMX = true;
58+
59+
$this->assertTrue($validator->isValid($email, new Email()));
60+
}
61+
5162
public function getValidEmails()
5263
{
5364
return array(

tests/Symfony/Tests/Component/Validator/Constraints/UrlValidatorTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public function getInvalidUrls()
7676
array('google.com'),
7777
array('http:/google.com'),
7878
array('http://google.com::aa'),
79+
array('http://google.foobar'),
80+
array('ftp://google.fr'),
7981
);
8082
}
8183

0 commit comments

Comments
 (0)