本文整理汇总了PHP中JFormInspector::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormInspector::bind方法的具体用法?PHP JFormInspector::bind怎么用?PHP JFormInspector::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormInspector
的用法示例。
在下文中一共展示了JFormInspector::bind方法的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.');
}