Add unit test for FieldList::getContainerField()

This commit is contained in:
Maxime Rainville 2018-10-08 14:24:19 +13:00
parent 51ba787ffb
commit a13a2cdd40

View File

@ -1176,4 +1176,18 @@ class FieldListTest extends SapphireTest
// put all your HiddenFields at the top level. // put all your HiddenFields at the top level.
$this->assertNotNull($visible->dataFieldByName('D2')); $this->assertNotNull($visible->dataFieldByName('D2'));
} }
public function testContainerField()
{
$fieldlist = new FieldList();
$container = CompositeField::create();
$this->assertNull($fieldlist->getContainerField());
$fieldlist->setContainerField($container);
$this->assertEquals($container, $fieldlist->getContainerField());
$fieldlist->setContainerField(null);
$this->assertNull($fieldlist->getContainerField());
}
} }