Esempio n. 1
0
 public function testTree()
 {
     $data = ['aaa' => 42, 'bbb' => ['x' => 11, 'y' => ['k' => 'AAA', 'm' => 22]], 'ccc' => 'VVV'];
     $tree = new Node($this->toNode($data));
     $exp = $data;
     $v1 = $tree->get('aaa');
     $this->assertEquals(42, $v1);
     $v2 = $tree->get('bbb.x');
     $this->assertEquals(11, $v2);
     $v3 = $tree->get('bbb.unknown');
     $this->assertEquals(null, $v3);
     $tree->set('nnn', 'NEW');
     $exp['nnn'] = 'NEW';
     $tree->set('mmm.also', 'NEW');
     $exp['mmm']['also'] = 'NEW';
     // $this->dumpObject($tree->getData());
 }