/**
  * @dataProvider executeProvider
  */
 public function testExecute($bundleName, $fileName, $className, $fqcn, $expectedException)
 {
     $application = new Application(static::$kernel);
     $application->add(new ConfigurationCommand());
     $command = $application->find('generate:configuration');
     // change bundlePath, fileName
     $this->util->setProperty($command, 'bundlePath', $this->dir)->setProperty($command, 'resourceDir', '/Tests/Fixtures');
     $options = array('--bundle' => $bundleName, '--file' => $fileName);
     if (!is_null($className)) {
         $options['--configuration'] = $className;
         $fileCheckOnly = false;
     } else {
         $className = 'Configuration';
         $fileCheckOnly = true;
     }
     $commandTester = new CommandTester($command);
     if ($expectedException) {
         $this->setExpectedException('\\Exception');
     }
     $commandTester->execute($options);
     // display and generate file
     $actual = $commandTester->getDisplay();
     // assert
     $expectedFileName = "{$this->diDir}/{$className}.php";
     $this->assertSame('Generated file ' . $expectedFileName . PHP_EOL, $actual);
     $this->assertTrue(self::$filesystem->exists($expectedFileName));
     // return if the className is default("Configuration") due to require
     if ($fileCheckOnly) {
         return;
     }
     // assert file contents
     require $expectedFileName;
     $configuration = new $fqcn();
     $tree = $configuration->getConfigTreeBuilder()->buildTree();
     $processor = new Processor();
     // use ConfigCacheBundle Processor
     $config = Yaml::parse(file_get_contents($this->util->getProperty($command, 'fileName')));
     list($loaded, $node) = $processor->process(array(), $config, $tree);
     $alias = static::$kernel->getBundle($bundleName)->getContainerExtension()->getAlias();
     $this->assertSame($config[$alias], $loaded);
 }
 /**
  * Processes an array of configurations.
  *
  * @param array                  $validated     validated array
  * @param array                  $validating    validating array
  * @param ConfigurationInterface $configuration configuration
  * @param ArrayNode              $masterNode    master node
  *
  * @return array list of (array, ArrayNode)
  */
 protected function processConfiguration(array $validated, array $validating, ConfigurationInterface $configuration, ArrayNode $masterNode = null)
 {
     $processor = new Processor();
     return $processor->processConfiguration($validated, $validating, $configuration, $masterNode);
 }