From 9e956a8ecd094df29034bde092d517884f90ab46 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 13 Apr 2012 18:57:23 +0200 Subject: [PATCH 1/2] [Form] Cleaned the FormValidatorInterface deprecation --- src/Symfony/Component/Form/Form.php | 14 +------------- .../DelegatingValidationListenerTest.php | 6 +++++- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 2c8f3c622c..8f9e7b6de2 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -77,7 +77,7 @@ class Form implements \IteratorAggregate, FormInterface /** * The mapper for mapping data to children and back - * @var DataMapper\DataMapperInterface + * @var DataMapperInterface */ private $dataMapper; @@ -801,18 +801,6 @@ class Form implements \IteratorAggregate, FormInterface return $this->clientTransformers; } - /** - * Returns the Validators - * - * @return array An array of FormValidatorInterface - * - * @deprecated Deprecated since version 2.1, to be removed in 2.3. - */ - public function getValidators() - { - return $this->validators; - } - /** * Returns all children in this group. * diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/DelegatingValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/DelegatingValidationListenerTest.php index 8c6a5bb538..0071b36fd7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/DelegatingValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/DelegatingValidationListenerTest.php @@ -32,7 +32,7 @@ class DelegatingValidationListenerTest extends \PHPUnit_Framework_TestCase private $delegate; - private $validator; + private $listener; private $message; @@ -40,6 +40,10 @@ class DelegatingValidationListenerTest extends \PHPUnit_Framework_TestCase protected function setUp() { + if (!class_exists('Symfony\Component\EventDispatcher\Event')) { + $this->markTestSkipped('The "EventDispatcher" component is not available'); + } + $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); $this->delegate = $this->getMock('Symfony\Component\Validator\ValidatorInterface'); From 538819a8bfdc7f78f67c37ae8f586f2f5e1f502c Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 13 Apr 2012 19:11:38 +0200 Subject: [PATCH 2/2] [Form] Fixed the tests --- src/Symfony/Component/Form/Tests/FormTest.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/FormTest.php b/src/Symfony/Component/Form/Tests/FormTest.php index d6784f4e52..a5c20dcbcf 100644 --- a/src/Symfony/Component/Form/Tests/FormTest.php +++ b/src/Symfony/Component/Form/Tests/FormTest.php @@ -1294,16 +1294,6 @@ class FormTest extends \PHPUnit_Framework_TestCase ->getForm(); } - public function testGetValidatorsReturnsValidators() - { - $validator = $this->getFormValidator(); - $form = $this->getBuilder() - ->addValidator($validator) - ->getForm(); - - $this->assertEquals(array($validator), $form->getValidators()); - } - protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null) { return new FormBuilder($name, $this->factory, $dispatcher ?: $this->dispatcher);