[FrameworkBundle] Use the correct service id for CachePoolPruneCommand in its compiler pass

This commit is contained in:
Bert Hekman 2018-05-03 11:00:23 +02:00 committed by Nicolas Grekas
parent 95ceeab3d7
commit 32c7ee35be
2 changed files with 4 additions and 6 deletions

View File

@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -27,7 +26,7 @@ class CachePoolPrunerPass implements CompilerPassInterface
private $cacheCommandServiceId;
private $cachePoolTag;
public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool')
public function __construct($cacheCommandServiceId = 'console.command.cache_pool_prune', $cachePoolTag = 'cache.pool')
{
$this->cacheCommandServiceId = $cacheCommandServiceId;
$this->cachePoolTag = $cachePoolTag;

View File

@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
@ -25,7 +24,7 @@ class CachePoolPrunerPassTest extends TestCase
public function testCompilerPassReplacesCommandArgument()
{
$container = new ContainerBuilder();
$container->register(CachePoolPruneCommand::class)->addArgument(array());
$container->register('console.command.cache_pool_prune')->addArgument(array());
$container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool');
$container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool');
@ -36,7 +35,7 @@ class CachePoolPrunerPassTest extends TestCase
'pool.foo' => new Reference('pool.foo'),
'pool.bar' => new Reference('pool.bar'),
);
$argument = $container->getDefinition(CachePoolPruneCommand::class)->getArgument(0);
$argument = $container->getDefinition('console.command.cache_pool_prune')->getArgument(0);
$this->assertInstanceOf(IteratorArgument::class, $argument);
$this->assertEquals($expected, $argument->getValues());
@ -64,7 +63,7 @@ class CachePoolPrunerPassTest extends TestCase
public function testCompilerPassThrowsOnInvalidDefinitionClass()
{
$container = new ContainerBuilder();
$container->register(CachePoolPruneCommand::class)->addArgument(array());
$container->register('console.command.cache_pool_prune')->addArgument(array());
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');
$pass = new CachePoolPrunerPass();