@@ 1040-1062 (lines=23) @@ | ||
1037 | * |
|
1038 | * @return void |
|
1039 | */ |
|
1040 | public function testGetFieldset() |
|
1041 | { |
|
1042 | // Prepare the form. |
|
1043 | $form = new JFormInspector('form1'); |
|
1044 | ||
1045 | $this->assertThat( |
|
1046 | $form->load(JFormDataHelper::$getFieldsetDocument), |
|
1047 | $this->isTrue(), |
|
1048 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
1049 | ); |
|
1050 | ||
1051 | $this->assertThat( |
|
1052 | $form->getFieldset('bogus'), |
|
1053 | $this->equalTo(array()), |
|
1054 | 'Line:' . __LINE__ . ' A fieldset that does not exist should return an empty array.' |
|
1055 | ); |
|
1056 | ||
1057 | $this->assertThat( |
|
1058 | count($form->getFieldset('params-basic')), |
|
1059 | $this->equalTo(4), |
|
1060 | 'Line:' . __LINE__ . ' There are 3 field elements in a fieldset and 1 field element marked with the fieldset attribute.' |
|
1061 | ); |
|
1062 | } |
|
1063 | ||
1064 | /** |
|
1065 | * Test for Form::getFieldsets method. |
|
@@ 1508-1529 (lines=22) @@ | ||
1505 | * |
|
1506 | * @return void |
|
1507 | */ |
|
1508 | public function testRemoveGroup() |
|
1509 | { |
|
1510 | $form = new JFormInspector('form1'); |
|
1511 | ||
1512 | $this->assertThat( |
|
1513 | $form->load(JFormDataHelper::$loadDocument), |
|
1514 | $this->isTrue(), |
|
1515 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
1516 | ); |
|
1517 | ||
1518 | $this->assertThat( |
|
1519 | $form->removeGroup('params'), |
|
1520 | $this->isTrue(), |
|
1521 | 'Line:' . __LINE__ . ' The removeGroup method should return true.' |
|
1522 | ); |
|
1523 | ||
1524 | $this->assertThat( |
|
1525 | $form->findGroup('params'), |
|
1526 | $this->equalTo(array()), |
|
1527 | 'Line:' . __LINE__ . ' The group should be removed, returning an empty array.' |
|
1528 | ); |
|
1529 | } |
|
1530 | ||
1531 | /** |
|
1532 | * Test for Form::setField method. |