/** * Loading values into form with element[blah][] style elements works */ function testLoadSetsComplexArrayValues() { $form = new SimpleForm_Form(); $form->parse($this->getFormHtml('complextextarrayform.html')); $data = array('textbox' => array('a' => 'testa', 'b' => 'testb', 'c' => 'testc', 'd' => array('text1', 'text2', 'text3'), 'f' => array(1 => 'test', 'g' => array('val1', 'val2')))); $form->load($data); $array = $form->getValues(); $this->assertEqual($array['textbox[a]'], 'testa'); $this->assertEqual($array['textbox[b]'], 'testb'); $this->assertEqual($array['textbox[c]'], 'testc'); $this->assertEqual($array['textbox[d]'], array('text1', 'text2', 'text3')); $this->assertEqual($array['textbox[e][meh]'], 'blah'); $this->assertNull($array['textbox[f][2]']); $this->assertNull($array['textbox[f][3]']); $this->assertEqual($array['textbox[f][g]'], array('val1', 'val2')); $this->assertEqual($array['textbox[q]'], array()); }