[Form] added tests for previous merge
This commit is contained in:
parent
3ad395c74c
commit
9b37637184
@ -42,6 +42,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
|
||||
|
||||
### Form
|
||||
|
||||
* added Form::getErrorsAsString() to help debugging forms
|
||||
* allowed setting different options for RepeatedType fields (like the label)
|
||||
|
||||
### HttpFoundation
|
||||
|
@ -1003,6 +1003,27 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame($parent, $view->getParent());
|
||||
}
|
||||
|
||||
public function testGetErrorsAsString()
|
||||
{
|
||||
$form = $this->getBuilder()->getForm();
|
||||
$form->addError(new FormError('Error!'));
|
||||
|
||||
$this->assertEquals("ERROR: Error!\n", $form->getErrorsAsString());
|
||||
}
|
||||
|
||||
public function testGetErrorsAsStringDeep()
|
||||
{
|
||||
$form = $this->getBuilder()->getForm();
|
||||
$form->addError(new FormError('Error!'));
|
||||
|
||||
$parent = $this->getBuilder()->getForm();
|
||||
$parent->add($form);
|
||||
|
||||
$parent->add($this->getBuilder('foo')->getForm());
|
||||
|
||||
$this->assertEquals("name:\n ERROR: Error!\nfoo:\n No errors\n", $parent->getErrorsAsString());
|
||||
}
|
||||
|
||||
protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
return new FormBuilder($name, $this->factory, $dispatcher ?: $this->dispatcher);
|
||||
|
Reference in New Issue
Block a user