function testValuesAreAutoloaded() { // fake the submission of the form $_GET[SimpleForm_Form::SUBMIT_MARKER] = 'inputform'; $_GET['firstname'] = 'Lachlan'; $_GET['lastname'] = 'Donald'; $form = new SimpleForm_Form(); $form->parse($this->getFormHtml('inputform.html')); $this->assertEqual(array('firstname' => 'Lachlan', 'lastname' => 'Donald'), $form->getValues()); }
function assertHasElementId(SimpleForm_Form $form, $id, $message = NULL) { if (is_null($message)) { $message = "form has no element with an id of {$id}"; } try { $element = $form->getElementById($id); $this->assertIsA($element, 'SimpleForm_Element'); } catch (SimpleForm_Exception $e) { $this->fail($message); } }
function testLoadRequestDoesntOverwriteNumericKeyArrays() { $form = new SimpleForm_Form(); $form->parse($this->getFormHtml('numberedtextarrayform.html')); $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST = array('textbox' => array(5 => 'test data')); $form->loadRequest(); $array = $form->getValues(); $this->assertEqual($array['textbox[5]'], 'test data'); }