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()); }
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"234 ' 44"', $input->render()); }
/** * @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; }