浏览代码

[Form] added a unit test

Fabien Potencier 14 年之前
父节点
当前提交
33498bffa4
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      tests/Symfony/Tests/Component/Form/Validator/DelegatingValidatorTest.php

+ 13 - 0
tests/Symfony/Tests/Component/Form/Validator/DelegatingValidatorTest.php

@@ -91,6 +91,19 @@ class DelegatingValidatorTest extends \PHPUnit_Framework_TestCase
         return $this->getMock('Symfony\Tests\Component\Form\FormInterface');
     }
 
+    public function testUseValidateValueWhenValidationConstraintExist()
+    {
+        $constraint = $this->getMockForAbstractClass('Symfony\Component\Validator\Constraint');
+        $form = $this
+            ->getBuilder('name')
+            ->setAttribute('validation_constraint', $constraint)
+            ->getForm();
+
+        $this->delegate->expects($this->once())->method('validateValue');
+
+        $this->validator->validate($form);
+    }
+
     public function testFormErrorsOnForm()
     {
         $form = $this->getForm();