/**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('stash');

        $rootNode
            ->beforeNormalization()
                ->ifTrue(function ($v) { return is_array($v) && !array_key_exists('default_cache', $v) && array_key_exists('caches', $v); })
                ->then(function ($v) {
                    return Configuration::normalizeDefaultCacheConfig($v);
                })
            ->end()
            ->beforeNormalization()
                ->ifTrue(function ($v) { return is_array($v) && !array_key_exists('caches', $v) && !array_key_exists('cache', $v); })
                ->then(function ($v) {
                    return Configuration::normalizeCacheConfig($v);
                })
            ->end()
            ->children()
                ->scalarNode('default_cache')->end()
                ->booleanNode('tracking')->end()
            ->end()
            ->fixXmlConfig('cache')
            ->append($this->getCachesNode())
        ;

        return $treeBuilder;
    }
 public function testNormalizeCacheConfig()
 {
     $testData = array('default_cache' => 'test', 'tracking' => 'test');
     $returnedData = Configuration::normalizeCacheConfig($testData);
     $this->assertInternalType('array', $returnedData, 'Returns array.');
     $this->assertArrayHasKey('default_cache', $returnedData, 'Normalization skips default_cache');
     $this->assertArrayHasKey('tracking', $returnedData, 'Normalization skips tracking');
     $testData = array('tracking' => 'test');
     $returnedData = Configuration::normalizeCacheConfig($testData);
     $this->assertArrayHasKey('default_cache', $returnedData, 'Normalization adds default_cache when missing');
     $testData = array('Settings1' => 'Data1', 'Settings2' => 'Data2', 'Settings3' => 'Data3');
     $returnedData = Configuration::normalizeCacheConfig($testData);
     $expectedResults = $returnedData['caches']['default'];
     $this->assertInternalType('array', $expectedResults, 'Returns array.');
     $this->assertEquals($testData, $expectedResults, 'Hanging settings converted to cache settings');
 }