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


PHP JFormInspector::filter方法代码示例

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


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

示例1: testFilter

 /**
  * Test for JForm::filter method.
  *
  * @return void
  */
 public function testFilter()
 {
     $form = new JFormInspector('form1');
     // Check the test data loads ok.
     $this->assertThat($form->load(JFormDataHelper::$filterDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $data = array('word' => 'Joomla! Framework', 'author' => 'Should not bind', 'params' => array('show_title' => 1, 'show_author' => false), 'default' => '');
     $filtered = $form->filter($data);
     $this->assertThat(is_array($filtered), $this->isTrue(), 'Line:' . __LINE__ . ' The filtered result should be an array.');
     // Test that filtering is occuring (not that all filters work - done in testFilterField).
     $this->assertThat($filtered['word'], $this->equalTo('JoomlaFramework'), 'Line:' . __LINE__ . ' The variable should be filtered by the "word" filter.');
     $this->assertThat(isset($filtered['author']), $this->isFalse(), 'Line:' . __LINE__ . ' A variable in the data not present in the form should not exist.');
     $this->assertThat($filtered['params']['show_title'], $this->equalTo(1), 'Line:' . __LINE__ . ' The nested variable should be present.');
     $this->assertThat($filtered['params']['show_author'], $this->equalTo(0), 'Line:' . __LINE__ . ' The nested variable should be present.');
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:19,代码来源:JFormTest.php


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