public function testGetValueBrackets() { $c = new HTML_QuickForm2_ContainerImpl('withBrackets'); $el1 = $c->appendChild(new HTML_QuickForm2_ElementImpl2('foo[]')); $el2 = $c->appendChild(new HTML_QuickForm2_ElementImpl2('foo[]')); $el1->setValue('first'); $el2->setValue('second'); $this->assertEquals(array('foo' => array('first', 'second')), $c->getValue()); }
public function testGetValue() { $c1 = new HTML_QuickForm2_ContainerImpl('hasValues'); $this->assertNull($c1->getValue()); $c2 = $c1->appendChild(new HTML_QuickForm2_ContainerImpl('sub')); $this->assertNull($c1->getValue()); $el1 = $c1->appendChild(new HTML_QuickForm2_ElementImpl2('foo[idx]')); $el2 = $c1->appendChild(new HTML_QuickForm2_ElementImpl2('bar')); $el3 = $c2->appendChild(new HTML_QuickForm2_ElementImpl2('baz')); $this->assertNull($c1->getValue()); $el1->setValue('a value'); $el2->setValue('other value'); $el3->setValue('yet another value'); $this->assertEquals(array('foo' => array('idx' => 'a value'), 'bar' => 'other value', 'baz' => 'yet another value'), $c1->getValue()); }