diff --git a/phpunit b/phpunit index 9cf03f071ecb..9806b0053f6d 100755 --- a/phpunit +++ b/phpunit @@ -11,7 +11,7 @@ */ // Please update when phpunit needs to be reinstalled with fresh deps: -// Cache-Id-Version: 2015-11-28 09:05 UTC +// Cache-Id-Version: 2016-03-16 15:36 UTC use Symfony\Component\Process\ProcessUtils; @@ -52,7 +52,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ $zip->close(); chdir("phpunit-$PHPUNIT_VERSION"); passthru("$COMPOSER remove --no-update symfony/yaml"); - passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\""); + passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=3.1@dev\""); passthru("$COMPOSER install --prefer-dist --no-progress --ansi"); file_put_contents('phpunit', << - Symfony\Component\HttpFoundation + Symfony\Component\HttpFoundation diff --git a/src/Symfony/Component/HttpKernel/phpunit.xml.dist b/src/Symfony/Component/HttpKernel/phpunit.xml.dist index 17c48935c715..b29969b36fe2 100644 --- a/src/Symfony/Component/HttpKernel/phpunit.xml.dist +++ b/src/Symfony/Component/HttpKernel/phpunit.xml.dist @@ -30,7 +30,7 @@ - Symfony\Component\HttpFoundation + Symfony\Component\HttpFoundation diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php index e291124f298d..10d17b5c68cd 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php @@ -11,9 +11,13 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Bridge\PhpUnit\DnsMock; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\EmailValidator; +/** + * @group dns-sensitive + */ class EmailValidatorTest extends AbstractConstraintValidatorTest { protected function createValidator() @@ -86,4 +90,39 @@ public function getInvalidEmails() array('example@localhost'), ); } + + /** + * @dataProvider getDnsChecks + */ + public function testDnsChecks($type, $violation) + { + DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? false : $type)))); + + $constraint = new Email(array( + 'message' => 'myMessage', + 'MX' === $type ? 'checkMX' : 'checkHost' => true, + )); + + $this->validator->validate('foo@example.com', $constraint); + + if (!$violation) { + $this->assertNoViolation(); + } else { + $this->buildViolation('myMessage') + ->setParameter('{{ value }}', '"foo@example.com"') + ->assertRaised(); + } + } + + public function getDnsChecks() + { + return array( + array('MX', false), + array('MX', true), + array('A', false), + array('A', true), + array('AAAA', false), + array('AAAA', true), + ); + } }