예제 #1
0
 /**
  * Test for JForm::getFieldsets method.
  *
  * @return void
  */
 public function testGetFieldsets()
 {
     // Prepare the form.
     $form = new JFormInspector('form1');
     $this->assertThat($form->load(JFormDataHelper::$getFieldsetsDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $sets = $form->getFieldsets();
     $this->assertThat(count($sets), $this->equalTo(3), 'Line:' . __LINE__ . ' The source data has 3 fieldsets in total.');
     $this->assertThat($sets['params-advanced']->name, $this->equalTo('params-advanced'), 'Line:' . __LINE__ . ' Ensure the fieldset name is correct.');
     $this->assertThat($sets['params-advanced']->label, $this->equalTo('Advanced Options'), 'Line:' . __LINE__ . ' Ensure the fieldset label is correct.');
     $this->assertThat($sets['params-advanced']->description, $this->equalTo('The advanced options'), 'Line:' . __LINE__ . ' Ensure the fieldset description is correct.');
     // Test loading by group.
     $this->assertThat($form->getFieldsets('bogus'), $this->equalTo(array()), 'Line:' . __LINE__ . ' A fieldset that in a group that does not exist should return an empty array.');
     $sets = $form->getFieldsets('details');
     $this->assertThat(count($sets), $this->equalTo(1), 'Line:' . __LINE__ . ' The details group has one field marked with a fieldset');
     $this->assertThat($sets['params-legacy']->name, $this->equalTo('params-legacy'), 'Line:' . __LINE__ . ' Ensure the fieldset name is correct.');
 }