public function testVerificaSeOFormularioRenderizouComSucesso()
 {
     $input = new Input();
     $input->setName("nome");
     $form = new Form();
     $form->displayAlert("top");
     $form->addField($input);
     $this->assertEquals('<form id="" action="" method="" class=""><p class="text-danger"></p><div class="form-group"><input type="" id="" name="nome" class="" value="" ></div></form>', $form->render());
 }
 public function getFormType()
 {
     $form = new Form();
     $form->displayAlert("inline");
     $form->setId("insert");
     $form->setAction("#");
     $form->setMethod("post");
     $input = new Input();
     $input->setLabel("Nome");
     $input->setId("nome");
     $input->setName("nome");
     if (isset($_POST['nome'])) {
         $input->setValue($_POST['nome']);
     }
     $input->setClass("form-control");
     $input2 = new Input();
     $input2->setLabel("Valor");
     $input2->setId("valor");
     $input2->setName("valor");
     if (isset($_POST['valor'])) {
         $input2->setValue($_POST['valor']);
     }
     $input2->setClass("form-control");
     $textarea = new Textarea();
     $textarea->setLabel("Descrição");
     $textarea->setId("descricao");
     $textarea->setName("descricao");
     if (isset($_POST['descricao'])) {
         $textarea->setValue($_POST['descricao']);
     }
     $textarea->setClass("form-control");
     $textarea->setRows(4);
     $select = new Select();
     $select->setLabel("Categoria");
     $select->setId("categoria");
     $select->setName("categoria");
     $select->addOption(array("value" => "1", "name" => "Tênis de corrida", "selected" => isset($_POST['categoria']) && $_POST['categoria'] == "1" ? "selected" : ""));
     $select->addOption(array("value" => "2", "name" => "Tênis de caminhada", "selected" => isset($_POST['categoria']) && $_POST['categoria'] == "2" ? "selected" : ""));
     $select->setClass("form-control");
     $submit = new Input();
     $submit->setType("submit");
     $submit->setValue("Enviar");
     $submit->setClass("form-control btn btn-primary");
     $form->addField($input);
     $form->addField($input2);
     $form->addField($textarea);
     $form->addField($select);
     $form->addField($submit);
     return $form->render();
 }