本文整理汇总了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" />');
}