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);
}