Example #1
0
 /**
  * Builds field data by name
  *
  * @param string $node field node name
  *
  * @return FieldNodeDefinition
  * @throws ItemNotFoundException
  */
 protected function buildFieldNode($node)
 {
     $fieldsRoot = $this->configBag->getFieldsRoot($node);
     if ($fieldsRoot === false) {
         throw new ItemNotFoundException(sprintf('Field "%s" is not defined.', $node));
     }
     return new FieldNodeDefinition($node, $fieldsRoot);
 }
Example #2
0
 /**
  * @dataProvider fieldsRootDataProvider
  *
  * @param array  $config
  * @param string $node
  * @param mixed  $expectedResult
  */
 public function testGetFieldsRoot($config, $node, $expectedResult)
 {
     $configBag = new ConfigBag($config, $this->container);
     $this->assertEquals($expectedResult, $configBag->getFieldsRoot($node));
 }