Exemplo n.º 1
0
 public function testNestedGetValueByPath()
 {
     $dataSet = new DataSet();
     $dataSet->push('level1');
     $dataSet->setValue('foo', 'bar');
     $this->assertEquals('bar', $dataSet->getValueByPath(['level1', 'foo'], true));
 }
Exemplo n.º 2
0
 /**
  * @covers Binary\DataSet::getValueByPath
  */
 public function testRelativeMultipleParentNestedGetValueByPath()
 {
     $dataSet = new DataSet();
     $dataSet->push('level1');
     $dataSet->setValue('foo', 'bar');
     $dataSet->push('level2');
     $dataSet->setValue('zoo', 'far');
     $dataSet->push('level3');
     $dataSet->setValue('fur', 'aff');
     $this->assertEquals('aff', $dataSet->getValueByPath(array('fur'), false));
     $this->assertEquals('bar', $dataSet->getValueByPath(array('..', '..', 'foo'), false));
 }