Пример #1
0
 /**
  * Test the Form::addNode method.
  *
  * @return void
  */
 public function testAddNode()
 {
     // The source data.
     $xml1 = simplexml_load_string('<form><fields /></form>');
     // The new data for adding the field.
     $xml2 = simplexml_load_string('<form><field name="foo" /></form>');
     if ($xml1 === false || $xml2 === false) {
         $this->fail('Error in text XML data');
     }
     JFormInspector::addNode($xml1->fields, $xml2->field);
     $fields = $xml1->xpath('fields/field[@name="foo"]');
     $this->assertThat(count($fields), $this->equalTo(1), 'Line:' . __LINE__ . ' The field should be added, ungrouped.');
 }