コード例 #1
0
 /**
  * @todo check actual placement of fields
  */
 public function testInsertAfterWithNestedTabsets()
 {
     $FieldListA = new FieldList($tabSetA = new TabSet('TabSet_A', $tabA1 = new Tab('Tab_A1', new TextField('A_pre'), new TextField('A'), new TextField('A_post')), $tabB1 = new Tab('Tab_B1', new TextField('B'))));
     $tabSetA->insertAfter($A_insertafter = new TextField('A_insertafter'), 'A');
     $this->assertEquals($FieldListA->dataFieldByName('A_insertafter'), $A_insertafter, 'Field on toplevel tab can be inserted after');
     $this->assertEquals(0, $tabA1->fieldPosition('A_pre'));
     $this->assertEquals(1, $tabA1->fieldPosition('A'));
     $this->assertEquals(2, $tabA1->fieldPosition('A_insertafter'));
     $this->assertEquals(3, $tabA1->fieldPosition('A_post'));
     $FieldListB = new FieldList(new TabSet('TabSet_A', $tabsetB = new TabSet('TabSet_B', $tabB1 = new Tab('Tab_B1', new TextField('C')), $tabB2 = new Tab('Tab_B2', new TextField('B_pre'), new TextField('B'), new TextField('B_post')))));
     $FieldListB->insertAfter($B_insertafter = new TextField('B_insertafter'), 'B');
     $this->assertSame($FieldListB->dataFieldByName('B_insertafter'), $B_insertafter, 'Field on nested tab can be inserted after');
     $this->assertEquals(0, $tabB2->fieldPosition('B_pre'));
     $this->assertEquals(1, $tabB2->fieldPosition('B'));
     $this->assertEquals(2, $tabB2->fieldPosition('B_insertafter'));
     $this->assertEquals(3, $tabB2->fieldPosition('B_post'));
 }