addError() public method

{@inheritDoc}
public addError ( Symfony\Component\Form\FieldError $error, Symfony\Component\Form\PropertyPathIterator $pathIterator = null, $type = null )
$error Symfony\Component\Form\FieldError
$pathIterator Symfony\Component\Form\PropertyPathIterator
Beispiel #1
0
 public function testAddErrorMapsErrorsOntoFieldsInAnonymousGroups()
 {
     // path is expected to point at "address"
     $expectedPath = new PropertyPath('address');
     $expectedPathIterator = $expectedPath->getIterator();
     $field = $this->createMockField('address');
     $field->expects($this->any())->method('getPropertyPath')->will($this->returnValue(new PropertyPath('address')));
     $field->expects($this->once())->method('addError')->with($this->equalTo('Message'), array(), $this->equalTo($expectedPathIterator), $this->equalTo(FieldGroup::DATA_ERROR));
     $group = new FieldGroup('author');
     $group2 = new FieldGroup('anonymous', array('property_path' => null));
     $group2->add($field);
     $group->add($group2);
     $path = new PropertyPath('address');
     $group->addError('Message', array(), $path->getIterator(), FieldGroup::DATA_ERROR);
 }