public function testCanGetAttributes() { $args = array('class' => array('form-class'), 'field_type' => 'search', 'format' => 'select', 'attributes' => array("one", "two"), 'label' => 'mylabel', 'placeholder' => 'myplaceholder', 'values' => array('one', 'three', 'four'), 'nested' => false, 'selected' => array('one'), 'pre_html' => '<h1>Some HTML</h1>', 'post_html' => '<span>more code</span>'); $input = new Input('my_input', $args); $input->toHTML(); $this->assertEquals($input->getInputName(), 'my_input'); $this->assertEquals($input->getClass(), 'form-class'); $this->assertEquals($input->getFieldType(), 'search'); $this->assertEquals($input->getFormat(), 'select'); $this->assertEquals($input->getAttributes(), array("one", "two")); $this->assertEquals($input->getLabel(), 'mylabel'); $this->assertEquals($input->getPlaceholder(), 'myplaceholder'); $this->assertEquals($input->getValues(), array('one', 'three', 'four')); $this->assertEquals($input->isNested(), false); $this->assertEquals($input->getSelected(), array('one')); $this->assertEquals($input->getPreHtml(), '<h1>Some HTML</h1>'); $this->assertEquals($input->getPostHtml(), '<span>more code</span>'); }
public function testVerificaSeOsDadosForamInseridos() { $input = new Input(); $input->setType("text"); $input->setId("inputUsuario"); $input->setName("usuario"); $input->setClass("form-control"); $input->setProtected("protected"); $input->setLabel("Usuário"); $input->setAlert("Erro no field."); $input->setValue("valor"); $this->assertEquals("text", $input->getType()); $this->assertEquals("inputUsuario", $input->getId()); $this->assertEquals("usuario", $input->getName()); $this->assertEquals("form-control", $input->getClass()); $this->assertEquals("protected", $input->getProtected()); $this->assertEquals("Usuário", $input->getLabel()); $this->assertEquals("Erro no field.", $input->getAlert()); $this->assertEquals("valor", $input->getValue()); }