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


PHP JFormInspector::reset方法代码示例

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


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

示例1: testReset

 /**
  * Test for JForm::setField method.
  *
  * @return void
  */
 public function testReset()
 {
     $form = new JFormInspector('form1');
     $this->assertThat($form->load(JFormDataHelper::$loadDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $data = array('title' => 'Joomla Framework', 'params' => array('show_title' => 2));
     $this->assertThat($form->bind($data), $this->isTrue(), 'Line:' . __LINE__ . ' The data should bind successfully.');
     $this->assertThat($form->getValue('title'), $this->equalTo('Joomla Framework'), 'Line:' . __LINE__ . ' Confirm the field value is set.');
     $this->assertThat($form->getValue('show_title', 'params'), $this->equalTo(2), 'Line:' . __LINE__ . ' Confirm the field value is set.');
     // Test reset on the data only.
     $this->assertThat($form->reset(), $this->isTrue(), 'Line:' . __LINE__ . ' The reset method should return true.');
     $this->assertThat($form->getField('title'), $this->logicalNot($this->isFalse()), 'Line:' . __LINE__ . ' The field should still exist.');
     $this->assertThat($form->getValue('title'), $this->equalTo(null), 'Line:' . __LINE__ . ' The field value should be reset.');
     $this->assertThat($form->getValue('show_title', 'params'), $this->equalTo(null), 'Line:' . __LINE__ . ' The field value should be reset.');
     // Test reset of data and the internal XML.
     $this->assertThat($form->reset(true), $this->isTrue(), 'Line:' . __LINE__ . ' The reset method should return true.');
     $this->assertThat($form->getField('title'), $this->isFalse(), 'Line:' . __LINE__ . ' The known field should be removed.');
     $this->assertThat($form->findGroup('params'), $this->equalTo(array()), 'Line:' . __LINE__ . ' The known group should be removed, returning an empty array.');
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:23,代码来源:JFormTest.php


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