mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
ec661a9886
commit
441bf4d910
@ -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 {
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user