本文整理匯總了PHP中Phalcon\Forms\Element\Text::render方法的典型用法代碼示例。如果您正苦於以下問題:PHP Text::render方法的具體用法?PHP Text::render怎麽用?PHP Text::render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\Forms\Element\Text
的用法示例。
在下文中一共展示了Text::render方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCreatingTextElementWithNameSimilarToTheFormMethods
/**
* Tests Text::render
*
* @issue 10398
* @author Serghei Iakovlev <serghei@phalconphp.com>
* @since 2016-07-17
*/
public function testCreatingTextElementWithNameSimilarToTheFormMethods()
{
$this->specify('Text::render does not return expected result', function ($name) {
$element = new Text($name);
expect($element->getName())->equals($name);
expect($element->render())->equals(sprintf('<input type="text" id="%s" name="%s" />', $name, $name));
expect($element->getValue())->null();
}, ['examples' => $this->nameLikeFormMethodsProvider()]);
}
示例2: testIssue2045
public function testIssue2045()
{
$this->specify("Attributes are not properly rendered", function () {
$element = new Text("name");
$element->setAttributes(["class" => "big-input"]);
$element->setAttribute("id", null);
$expected = '<input type="text" name="name" class="big-input" />';
expect($element->render())->equals($expected);
});
}
示例3: testFormElementRender
public function testFormElementRender()
{
$element1 = new Text("name");
$element1->setAttributes(array('class' => 'big-input'));
$element2 = new Radio('radio');
$element2->setAttributes(array('value' => 0));
$this->assertEquals('<input type="text" id="name" name="name" class="big-input" />', $element1->render());
$this->assertEquals('<input type="text" id="name" name="name" class="big-input" />', (string) $element1);
$this->assertEquals('<input type="radio" id="radio" name="radio" value="0" />', (string) $element2);
}
示例4: testIssue2045
public function testIssue2045()
{
$element = new \Phalcon\Forms\Element\Text("name");
$element->setAttributes(array('class' => 'big-input'));
$element->setAttribute("id", NULL);
$this->assertEquals('<input type="text" name="name" class="big-input" />', $element->render());
}
示例5: testRenderCompare
public function testRenderCompare()
{
$phalconText = new Text('test');
$vegasText = new \Vegas\Forms\Element\Text('test');
$this->assertEquals($phalconText->render(), $vegasText->renderDecorated());
}
示例6: testFormElementRender
public function testFormElementRender()
{
$element1 = new Text("name");
$element1->setAttributes(array('class' => 'big-input'));
$this->assertEquals($element1->render(), '<input class="big-input" name="name" id="name" value="" type="text" />');
$this->assertEquals((string) $element1, '<input class="big-input" name="name" id="name" value="" type="text" />');
}