[Form] Added getValidators() to Form class
This commit is contained in:
parent
cab70f4083
commit
601d462589
@ -770,6 +770,16 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $this->clientTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Validators
|
||||
*
|
||||
* @return array An array of FormValidatorInterface
|
||||
*/
|
||||
public function getValidators()
|
||||
{
|
||||
return $this->validators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all children in this group.
|
||||
*
|
||||
|
@ -1024,6 +1024,16 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals("name:\n ERROR: Error!\nfoo:\n No errors\n", $parent->getErrorsAsString());
|
||||
}
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user