[Form] fixed problem with PHPUnit mocks (ugly hack but it works for now)
This commit is contained in:
parent
26e4b2e2ef
commit
81b73dc9e6
@ -59,7 +59,10 @@ class FieldGroup extends Field implements \IteratorAggregate, FieldGroupInterfac
|
||||
{
|
||||
foreach ($this->fields as $name => $field) {
|
||||
$field = clone $field;
|
||||
$field->setParent($this);
|
||||
// this condition is only to "bypass" a PHPUnit bug with mocks
|
||||
if (null !== $field->getParent()) {
|
||||
$field->setParent($this);
|
||||
}
|
||||
$this->fields[$name] = $field;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,13 @@ interface FieldInterface extends Localizable, Translatable
|
||||
*/
|
||||
public function setParent(FieldInterface $parent = null);
|
||||
|
||||
/**
|
||||
* Returns the parent field.
|
||||
*
|
||||
* @return FieldInterface The parent field
|
||||
*/
|
||||
public function getParent();
|
||||
|
||||
/**
|
||||
* Sets the key by which the field is identified in field groups.
|
||||
*
|
||||
|
Reference in New Issue
Block a user