Skip to content

Commit 14c62da

Browse files
committed
fix CachePoolPrunerPass to use correct command service id
1 parent fdac9e3 commit 14c62da

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPrunerPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
1415
use Symfony\Component\Cache\PruneableInterface;
1516
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -26,7 +27,7 @@ class CachePoolPrunerPass implements CompilerPassInterface
2627
private $cacheCommandServiceId;
2728
private $cachePoolTag;
2829

29-
public function __construct($cacheCommandServiceId = 'cache.command.pool_pruner', $cachePoolTag = 'cache.pool')
30+
public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool')
3031
{
3132
$this->cacheCommandServiceId = $cacheCommandServiceId;
3233
$this->cachePoolTag = $cachePoolTag;

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
1516
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass;
1617
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1718
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
@@ -24,7 +25,7 @@ class CachePoolPrunerPassTest extends TestCase
2425
public function testCompilerPassReplacesCommandArgument()
2526
{
2627
$container = new ContainerBuilder();
27-
$container->register('cache.command.pool_pruner')->addArgument(array());
28+
$container->register(CachePoolPruneCommand::class)->addArgument(array());
2829
$container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool');
2930
$container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool');
3031

@@ -35,7 +36,7 @@ public function testCompilerPassReplacesCommandArgument()
3536
'pool.foo' => new Reference('pool.foo'),
3637
'pool.bar' => new Reference('pool.bar'),
3738
);
38-
$argument = $container->getDefinition('cache.command.pool_pruner')->getArgument(0);
39+
$argument = $container->getDefinition(CachePoolPruneCommand::class)->getArgument(0);
3940

4041
$this->assertInstanceOf(IteratorArgument::class, $argument);
4142
$this->assertEquals($expected, $argument->getValues());
@@ -51,7 +52,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
5152
$container
5253
->expects($this->atLeastOnce())
5354
->method('hasDefinition')
54-
->with('cache.command.pool_pruner')
55+
->with(CachePoolPruneCommand::class)
5556
->will($this->returnValue(false));
5657

5758
$container
@@ -73,7 +74,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
7374
public function testCompilerPassThrowsOnInvalidDefinitionClass()
7475
{
7576
$container = new ContainerBuilder();
76-
$container->register('cache.command.pool_pruner')->addArgument(array());
77+
$container->register(CachePoolPruneCommand::class)->addArgument(array());
7778
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');
7879

7980
$pass = new CachePoolPrunerPass();

0 commit comments

Comments
 (0)