コード例 #1
0
ファイル: JFormTest.php プロジェクト: SysBind/joomla-cms
 /**
  * Test the JForm::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.');
 }