public function testAppend() { $data = new Dwoo_Data(); $data->assign('var', 'val'); $data->append('var', 'moo'); $this->assertEquals(array('var' => array('val', 'moo')), $data->getData()); $data->assign('var', 'val'); $data->append(array('var' => 'moo', 'var2' => 'bar')); $this->assertEquals(array('var' => array('val', 'moo'), 'var2' => array('bar')), $data->getData()); }
public function testMagicGetSetStuff() { $data = new Dwoo_Data(); $data->variable = 'val'; $data->append('variable', 'moo'); $this->assertEquals(array('val', 'moo'), $data->get('variable')); $this->assertEquals(array('val', 'moo'), $data->variable); $this->assertEquals(true, $data->isAssigned('variable')); }
public function append($name, $val = null, $merge = false) { if (is_array($val)) { foreach ($val as $k => $v) { $this->data[$name][$k] = $v; } } else { parent::append($name, $val, $merge); } }