예제 #1
0
 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());
 }
예제 #2
0
 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'));
 }
예제 #3
0
 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);
     }
 }