Esempio n. 1
0
 public function testHandleRequest()
 {
     $input = new Input();
     $input->setName('email');
     $input->handle(new FormData(FormData::METHOD_POST, ['email' => '*****@*****.**']));
     $this->assertEquals('*****@*****.**', $input->getValue());
     $input->handle(new FormData(FormData::METHOD_POST, []));
     $this->assertNull($input->getValue());
 }
Esempio n. 2
0
 public function testValueWithSlashes()
 {
     $input = new Input();
     $input->setName('test');
     $input->setType('hidden');
     $value = ' 123"234 \' 44 ';
     $input->addFilter(new CallbackFilter('trim'));
     $input->setValue($value);
     $this->assertContains('<input type="hidden" name="test" value="123&quot;234 &#039; 44"', $input->render());
 }
Esempio n. 3
0
 /**
  * @param string $name
  * @param string|null $text
  * @return \Fiv\Form\Element\Input
  */
 public function input($name, $text = null)
 {
     $input = new Element\Input();
     $input->setName($name);
     $input->setText($text);
     $this->addElement($input);
     return $input;
 }