/** * Tests Text::render * * @issue 10398 * @author Serghei Iakovlev <*****@*****.**> * @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()]); }
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); }); }
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); }
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()); }
public function testRenderCompare() { $phalconText = new Text('test'); $vegasText = new \Vegas\Forms\Element\Text('test'); $this->assertEquals($phalconText->render(), $vegasText->renderDecorated()); }
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" />'); }