当前位置: 首页>>代码示例>>PHP>>正文


PHP JFormInspector::findFieldsByGroup方法代码示例

本文整理汇总了PHP中JFormInspector::findFieldsByGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormInspector::findFieldsByGroup方法的具体用法?PHP JFormInspector::findFieldsByGroup怎么用?PHP JFormInspector::findFieldsByGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFormInspector的用法示例。


在下文中一共展示了JFormInspector::findFieldsByGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLoad

 /**
  * Test the JForm::load method.
  *
  * This method can load an XML data object, or parse an XML string.
  *
  * @return void
  */
 public function testLoad()
 {
     $form = new JFormInspector('form1');
     $this->assertThat($form->load(JFormDataHelper::$loadDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $this->assertThat($form->getXml() instanceof SimpleXMLElement, $this->isTrue(), 'Line:' . __LINE__ . ' The internal XML should be a SimpleXMLElement object.');
     // Test replace false.
     $this->assertThat($form->load(JFormDataHelper::$loadMergeDocument, false), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $this->assertThat(count($form->getXml()->xpath('/form/fields/field')), $this->equalTo(4), 'Line:' . __LINE__ . ' There are 2 new ungrouped field and one existing field should merge, resulting in 4 total.');
     // Test replace true (default).
     $form = new JFormInspector('form1');
     $this->assertThat($form->load(JFormDataHelper::$loadDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $this->assertThat($form->load(JFormDataHelper::$loadMergeDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     // @todo remove: $this->_showXml($form);die;
     $this->assertThat(count($form->findFieldsByGroup(false)), $this->equalTo(6), 'Line:' . __LINE__ . ' There are 2 original ungrouped fields, 1 replaced and 4 new, resulting in 6 total.');
     $this->assertThat(count($form->getXml()->xpath('//fields[@name]')), $this->equalTo(2), 'Line:' . __LINE__ . ' The XML has 2 fields tags with a name attribute.');
     $this->assertThat(count($form->getXml()->xpath('//fields[@name="params"]/field')), $this->equalTo(2), 'Line:' . __LINE__ . ' The params fields have been merged ending with 2 elements.');
     $this->assertThat(count($form->getXml()->xpath('/form/fields/fields[@name="params"]/field[@name="show_abstract"]')), $this->equalTo(1), 'Line:' . __LINE__ . ' The show_title in the params group has been replaced by show_abstract.');
     $originalform = new JFormInspector('form1');
     $originalform->load(JFormDataHelper::$loadDocument);
     $originalset = $originalform->getXml()->xpath('/form/fields/field');
     $set = $form->getXml()->xpath('/form/fields/field');
     for ($i = 0; $i < count($originalset); $i++) {
         $this->assertThat((string) $originalset[$i]->attributes()->name == (string) $set[$i]->attributes()->name, $this->isTrue(), 'Line:' . __LINE__ . ' Replace should leave fields in the original order.');
     }
     return $form;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:33,代码来源:JFormTest.php


注:本文中的JFormInspector::findFieldsByGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。