Explorar o código

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

Jeremy Mikola %!s(int64=14) %!d(string=hai) anos
pai
achega
4e0db56810

+ 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());