本文整理汇总了PHP中JFormInspector::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormInspector::getData方法的具体用法?PHP JFormInspector::getData怎么用?PHP JFormInspector::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormInspector
的用法示例。
在下文中一共展示了JFormInspector::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBind
/**
* Tests the JForm::bind method.
*
* This method is used to load data into the JForm object.
*
* @return void
*/
public function testBind()
{
$form = new JFormInspector('form1');
$xml = JFormDataHelper::$bindDocument;
// Check the test data loads ok.
$this->assertThat($form->load($xml), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
$data = array('title' => 'Joomla Framework', 'author' => 'Should not bind', 'params' => array('show_title' => 1, 'show_abstract' => 0, 'show_author' => 1, 'categories' => array(1, 2), 'keywords' => array('en-GB' => 'Joomla', 'fr-FR' => 'Joomla')));
$this->assertThat($form->bind($data), $this->isTrue(), 'Line:' . __LINE__ . ' The data should bind successfully.');
$data = $form->getData();
$this->assertThat($data->get('title'), $this->equalTo('Joomla Framework'), 'Line:' . __LINE__ . ' The data should bind to form field elements.');
$this->assertThat($data->get('author'), $this->isNull(), 'Line:' . __LINE__ . ' The data should not bind to unknown form field elements.');
$this->assertThat(is_array($data->get('params.categories')), $this->isTrue(), 'Line:' . __LINE__ . ' The categories param should be an array.');
}