MINOR Test for insertBefore functionality on FieldSet::addFieldsToTab()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114818 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-12-11 03:38:11 +00:00
parent ec661a9886
commit 441bf4d910

View File

@ -335,7 +335,34 @@ class FieldSetTest extends SapphireTest {
/* The position of the Title field is at number 3 */
$this->assertEquals(3, $fields->fieldByName('Title')->Pos());
}
function testInsertBeforeMultipleFields() {
$fields = new FieldSet(
$root = new TabSet("Root",
$main = new Tab("Main",
$a = new TextField("A"),
$b = new TextField("B")
)
)
);
$fields->addFieldsToTab('Root.Main', array(
new TextField('NewField1'),
new TextField('NewField2')
), 'B');
$result = array();
foreach($fields->dataFields() as $field) {
$result[] = $field->Name();
}
$this->assertEquals($result, array(
'A',
'NewField1',
'NewField2',
'B'
));
}
/**
* Test inserting a field after another in a set.
*/
@ -707,4 +734,3 @@ class FieldSetTest extends SapphireTest {
);
}
}
?>