Hostnet\Bundle\WebpackBundle\DependencyInjection\Configuration::getConfigTreeBuilder PHP Method

getConfigTreeBuilder() public method

    public function getConfigTreeBuilder()
    {
        $tree_builder = new TreeBuilder();
        $root_node = $tree_builder->root(self::CONFIG_ROOT);
        $children = $root_node->children();
        $root_node->fixXmlConfig('bundle');
        $this->addNodeJSConfiguration($children);
        $this->addParentConfiguration($children);
        $this->addBundleConfiguration($children);
        $this->addLoaderConfiguration($children);
        $this->addPluginConfiguration($children);
        $children->integerNode('compile_timeout')->defaultValue(self::DEFAULT_COMPILE_TIMEOUT_SECONDS)->end();
        $children->end();
        return $tree_builder;
    }

Usage Example

 public function testGetConfigTreeBuilder()
 {
     $config = new Configuration([], [DefinePlugin::class, CSSLoader::class]);
     $tree = $config->getConfigTreeBuilder();
     $final = $tree->buildTree()->finalize([]);
     $this->assertArrayHasKey('node', $final);
     $this->assertArrayHasKey('binary', $final['node']);
     $this->assertArrayHasKey('win32', $final['node']['binary']);
     $this->assertArrayHasKey('win64', $final['node']['binary']);
     $this->assertArrayHasKey('linux_x32', $final['node']['binary']);
     $this->assertArrayHasKey('linux_x64', $final['node']['binary']);
     $this->assertArrayHasKey('darwin', $final['node']['binary']);
     $this->assertArrayHasKey('fallback', $final['node']['binary']);
 }