Example #1
0
 public function testRenderWithEmptyForm()
 {
     $form = new \HtmlForm\Form();
     $expected = '<form method="post" action="index.php?test=aha" id="hfc" ></form>';
     $result = $form->render();
     $this->assertEquals($expected, $result);
 }
Example #2
0
 public function testHoneypot()
 {
     $validator = new Validator();
     // test pass
     $form = new \HtmlForm\Form();
     $form->addHoneypot();
     $result = $validator->validate($form);
     $this->assertFalse($validator->honeypotError);
     // test fail
     $result = $validator->honeypot("string");
     $this->assertTrue($validator->honeypotError);
 }