浏览代码

[Form] Fix getValidator() to reference the "validator" option instead of property

Jeremy Mikola 14 年之前
父节点
当前提交
4e0db56810
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 1
      src/Symfony/Component/Form/Form.php
  2. 5 0
      tests/Symfony/Tests/Component/Form/FormTest.php

+ 1 - 1
src/Symfony/Component/Form/Form.php

@@ -662,7 +662,7 @@ class Form extends Field implements \IteratorAggregate, FormInterface
      */
     public function getValidator()
     {
-        return $this->validator;
+        return $this->getOption('validator');
     }
 
     /**

+ 5 - 0
tests/Symfony/Tests/Component/Form/FormTest.php

@@ -169,6 +169,11 @@ class FormTest extends \PHPUnit_Framework_TestCase
         $this->assertFalse($form->isCsrfTokenValid());
     }
 
+    public function testGetValidator()
+    {
+        $this->assertSame($this->validator, $this->form->getValidator());
+    }
+
     public function testValidationGroupNullByDefault()
     {
         $this->assertNull($this->form->getValidationGroups());