/** * @covers Binary\DataSet::getValueByPath */ public function testNestedGetValueByPath() { $dataSet = new DataSet(); $dataSet->push('level1'); $dataSet->setValue('foo', 'bar'); $this->assertEquals('bar', $dataSet->getValueByPath(array('level1', 'foo'), true)); }
/** * @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)); }
/** * @dataProvider invalidPaths * @expectedException \Zerg\Field\ConfigurationException */ public function testParsePathException($currentPath, $pathString) { $dataSet = new DataSet(); foreach ($currentPath as $part) { $dataSet->push($part); } $dataSet->parsePath($pathString); }