Example #1
0
 /**
  * @param string $treeName
  * @param int    $correctFieldsLevel
  *
  * @throws ItemNotFoundException
  * @return GroupNodeDefinition
  */
 protected function getTreeData($treeName, $correctFieldsLevel)
 {
     if (!isset($this->processedTrees[$treeName])) {
         $treeRoot = $this->configBag->getTreeRoot($treeName);
         if ($treeRoot === false) {
             throw new ItemNotFoundException(sprintf('Tree "%s" is not defined.', $treeName));
         }
         $definition = $treeRoot;
         $data = $this->buildGroupNode($definition, $correctFieldsLevel);
         $tree = new GroupNodeDefinition($treeName, $definition, $data);
         $this->processedTrees[$tree->getName()] = $tree;
     }
     return $this->processedTrees[$treeName];
 }
Example #2
0
 /**
  * @dataProvider treeRootDataProvider
  *
  * @param array  $config
  * @param string $treeName
  * @param mixed  $expectedResult
  */
 public function testGetTreeRoot($config, $treeName, $expectedResult)
 {
     $configBag = new ConfigBag($config, $this->container);
     $this->assertEquals($expectedResult, $configBag->getTreeRoot($treeName));
 }