Yaffs site version 1.1
[yaffs-website] / vendor / symfony / validator / Tests / Constraints / EmailValidatorTest.php
index cfa0e99c923255f8cba1ca87a562b0bdd5d6cf58..5933bd5ed6a65d5448f85658ba1e151bfcfb6d6e 100644 (file)
@@ -159,4 +159,32 @@ class EmailValidatorTest extends AbstractConstraintValidatorTest
 
         $this->assertNoViolation();
     }
+
+    /**
+     * @dataProvider provideCheckTypes
+     */
+    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();
+    }
+
+    public function provideCheckTypes()
+    {
+        return array(
+            array('checkMX', Email::MX_CHECK_FAILED_ERROR),
+            array('checkHost', Email::HOST_CHECK_FAILED_ERROR),
+        );
+    }
 }