/** * Gets a test form. * * @return T_Form_Get test form */ protected function getTestForm() { $form = new T_Form_Get('test', 'A Test Form'); $form->addChild(new T_Form_Fieldset('contact', 'Contact Details')); $form->contact->addChild(new T_Form_Text('name', 'Name')); $form->contact->name->setOptional(); $form->contact->addChild(new T_Form_Text('email', 'Email')); $form->contact->email->setOptional(); $form->contact->addChild(new T_Form_Upload('upload', 'Profile Image')); $form->contact->upload->setOptional(); $form->addChild(new T_Form_Fieldset('register', 'Registration Details')); $form->register->addChild(new T_Form_Password('passwd', 'Password')); $form->register->passwd->setOptional(); return $form; }
/** * Gets a test form. * * @return T_Form_Get test form */ protected function getTestForm() { $form = new T_Form_Get('test', 'A Test Form'); $form->setForward(new T_Url('http', 'example.com', array('te&st'))); $form->addChild(new T_Form_Fieldset('contact', 'Cont"act" Details')); $form->contact->addChild(new T_Form_Text('name', 'Name')); $form->contact->name->setAttribute('size', 50)->setAttribute('maxlength', 50)->setHelp('some help'); $form->contact->addChild(new T_Form_Text('email', 'Em="ail')); $form->contact->email->setDefault('*****@*****.**')->setOptional(); return $form; }
function testThatPreFilterDoesNotValidateFormIfNotPresent() { $env = $this->getEnvironment(); $form = new T_Form_Get('myform', 'Test Form'); $form->addChild(new T_Test_Form_ElementStub('element', 'Label')); $filter = new T_Form_GetHandler($form, $env); $response = new T_Response(); $filter->preFilter($response); $this->assertFalse($form->isPresent()); $this->assertFalse($form->element->isValidated()); }