本文整理汇总了PHP中JFormInspector::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormInspector::getLabel方法的具体用法?PHP JFormInspector::getLabel怎么用?PHP JFormInspector::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormInspector
的用法示例。
在下文中一共展示了JFormInspector::getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetInput
/**
* Test the getInput method.
*
* @return void
*/
public function testGetInput()
{
$form = new JFormInspector('form1');
// Test a traditional hidden field type.
$this->assertThat(
$form->load('<form><field name="hidden" type="hidden" label="foo" /></form>'),
$this->isTrue(),
'Line:' . __LINE__ . ' XML string should load successfully.'
);
$field = new JFormFieldHidden($form);
$this->assertThat(
$form->getLabel('hidden'),
$this->equalTo(''),
'Line:' . __LINE__ . ' The label of a hidden element should be nothing.'
);
// Test a field with attribute hidden = true.
$this->assertThat(
$form->load('<form><field name="hidden" type="text" label="foo" hidden="true" /></form>'),
$this->isTrue(),
'Line:' . __LINE__ . ' XML string should load successfully.'
);
$field = new JFormFieldHidden($form);
$this->assertThat(
$form->getLabel('hidden'),
$this->equalTo(''),
'Line:' . __LINE__ . ' The label of a hidden element should be nothing.'
);
// Test a field with attribute hidden = false.
$this->assertThat(
$form->load('<form><field name="hidden" type="text" label="foo" hidden="false" /></form>'),
$this->isTrue(),
'Line:' . __LINE__ . ' XML string should load successfully.'
);
$field = new JFormFieldHidden($form);
$this->assertThat(
$form->getLabel('hidden'),
$this->equalTo('<label id="hidden-lbl" for="hidden" class="">foo</label>'),
'Line:' . __LINE__ . ' The label of a non-hidden element should be some HTML.'
);
}
示例2: testGetLabel
/**
* Test for JForm::getLabel method.
*
* @return void
*/
public function testGetLabel()
{
$form = new JFormInspector('form1');
$this->assertThat($form->load(JFormDataHelper::$loadFieldDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
$matcher = array('id' => 'title_id-lbl', 'tag' => 'label', 'attributes' => array('for' => 'title_id', 'class' => 'hasTooltip required', 'title' => '<strong>Title</strong><br />The title.'), 'content' => 'regexp:/Title.*\\*/', 'child' => array('tag' => 'span', 'attributes' => array('class' => 'star'), 'content' => 'regexp:/\\*/'));
$this->assertTag($matcher, $form->getLabel('title'), 'Line:' . __LINE__ . ' The method should return a simple label field.');
}
示例3: testGetLabel
/**
* Test for JForm::getLabel method.
*
* @return void
*/
public function testGetLabel()
{
$form = new JFormInspector('form1');
$this->assertThat(
$form->load(JFormDataHelper::$loadFieldDocument),
$this->isTrue(),
'Line:' . __LINE__ . ' XML string should load successfully.'
);
$this->assertThat(
$form->getLabel('title'),
$this->equalTo('<label id="title_id-lbl" for="title_id" class="hasTip required" title="Title::The title.">Title<span class="star"> *</span></label>'),
'Line:' . __LINE__ . ' The method should return a simple label field.'
);
}