public function testAddErrorMapsErrorsOntoFieldsInAnonymousGroups() { // path is expected to point at "address" $expectedPath = new PropertyPath('address'); $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'), $this->equalTo($expectedPath), $this->equalTo(FieldGroup::DATA_ERROR)); $group = new FieldGroup('author'); $group2 = new FieldGroup('anonymous', array('property_path' => null)); $group2->add($field); $group->add($group2); $group->addError('Message', new PropertyPath('address'), FieldGroup::DATA_ERROR); }