本文整理汇总了PHP中JFormInspector::loadFieldType方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormInspector::loadFieldType方法的具体用法?PHP JFormInspector::loadFieldType怎么用?PHP JFormInspector::loadFieldType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormInspector
的用法示例。
在下文中一共展示了JFormInspector::loadFieldType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadFieldType
/**
* Test the JForm::loadFieldType method.
*
* @return void
*/
public function testLoadFieldType()
{
$inspector = new JFormInspector('test');
$this->assertThat($inspector->loadFieldType('bogus'), $this->isFalse(), 'Line:' . __LINE__ . ' loadFieldType should return false if class not found.');
$this->assertThat($inspector->loadFieldType('list') instanceof JFormFieldList, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct class.');
// Add custom path.
JForm::addFieldPath(__DIR__ . '/_testfields');
$this->assertThat($inspector->loadFieldType('test') instanceof JFormFieldTest, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
$this->assertThat($inspector->loadFieldType('foo.bar') instanceof FooFormFieldBar, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
$this->assertThat($inspector->loadFieldType('modal_foo') instanceof JFormFieldModal_Foo, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
$this->assertThat($inspector->loadFieldType('foo.modal_bar') instanceof FooFormFieldModal_Bar, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
}
示例2: testLoadFieldType
/**
* Test the JForm::loadFieldType method.
*/
public function testLoadFieldType()
{
$this->assertThat(JFormInspector::loadFieldType('bogus'), $this->isFalse(), 'Line:' . __LINE__ . ' loadFieldType should return false if class not found.');
$this->assertThat(JFormInspector::loadFieldType('list') instanceof JFormFieldList, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct class.');
// Add custom path.
JForm::addFieldPath(dirname(__FILE__) . '/_testfields');
$this->assertThat(JFormInspector::loadFieldType('test') instanceof JFormFieldTest, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
}