From 193542f84f704592b25bba33bb502222c6ea6a9c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 9 Sep 2016 12:14:33 +0200 Subject: [PATCH] [FrameworkBundle] Remove cache clearer default value in config --- .../DependencyInjection/Configuration.php | 2 +- .../Tests/Functional/CachePoolsTest.php | 20 ++++++++++++------- .../Functional/app/CachePools/config.yml | 7 ++++++- .../app/CachePools/redis_config.yml | 5 ++++- .../app/CachePools/redis_custom_config.yml | 5 ++++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 4c153f0629..eb7c2d85ba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -585,7 +585,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('provider') ->info('The service name to use as provider when the specified adapter needs one.') ->end() - ->scalarNode('clearer')->defaultValue('cache.default_clearer')->end() + ->scalarNode('clearer')->end() ->end() ->end() ->validate() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index 565354343e..9fc420e2c8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -62,22 +62,28 @@ class CachePoolsTest extends WebTestCase static::bootKernel($options); $container = static::$kernel->getContainer(); - $pool = $container->get('cache.test'); - $this->assertInstanceOf($adapterClass, $pool); + $pool1 = $container->get('cache.pool1'); + $this->assertInstanceOf($adapterClass, $pool1); $key = 'foobar'; - $pool->deleteItem($key); - $item = $pool->getItem($key); + $pool1->deleteItem($key); + $item = $pool1->getItem($key); $this->assertFalse($item->isHit()); $item->set('baz'); - $pool->save($item); - $item = $pool->getItem($key); + $pool1->save($item); + $item = $pool1->getItem($key); $this->assertTrue($item->isHit()); + $pool2 = $container->get('cache.pool2'); + $pool2->save($item); + $container->get('cache_clearer')->clear($container->getParameter('kernel.cache_dir')); - $item = $pool->getItem($key); + $item = $pool1->getItem($key); $this->assertFalse($item->isHit()); + + $item = $pool2->getItem($key); + $this->assertTrue($item->isHit()); } protected static function createKernel(array $options = array()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml index 20d966780c..eabf83825e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml @@ -4,5 +4,10 @@ imports: framework: cache: pools: - cache.test: + cache.pool1: public: true + cache.pool2: + public: true + adapter: cache.pool3 + cache.pool3: + clearer: ~ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml index ae1fbf62a6..223f074a56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml @@ -5,5 +5,8 @@ framework: cache: app: cache.adapter.redis pools: - cache.test: + cache.pool1: public: true + cache.pool2: + public: true + clearer: ~ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml index 3c99f05ac7..c868317512 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml @@ -17,5 +17,8 @@ services: framework: cache: pools: - cache.test: + cache.pool1: public: true + cache.pool2: + public: true + clearer: ~