Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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;
Expand All @@ -26,7 +27,7 @@ class CachePoolPrunerPass implements CompilerPassInterface
private $cacheCommandServiceId;
private $cachePoolTag;

public function __construct($cacheCommandServiceId = 'cache.command.pool_pruner', $cachePoolTag = 'cache.pool')
public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool')
{
$this->cacheCommandServiceId = $cacheCommandServiceId;
$this->cachePoolTag = $cachePoolTag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;
Expand All @@ -24,7 +25,7 @@ class CachePoolPrunerPassTest extends TestCase
public function testCompilerPassReplacesCommandArgument()
{
$container = new ContainerBuilder();
$container->register('cache.command.pool_pruner')->addArgument(array());
$container->register(CachePoolPruneCommand::class)->addArgument(array());
$container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool');
$container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool');

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

$this->assertInstanceOf(IteratorArgument::class, $argument);
$this->assertEquals($expected, $argument->getValues());
Expand All @@ -51,7 +52,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
$container
->expects($this->atLeastOnce())
->method('hasDefinition')
->with('cache.command.pool_pruner')
->with(CachePoolPruneCommand::class)
->will($this->returnValue(false));

$container
Expand All @@ -73,7 +74,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
public function testCompilerPassThrowsOnInvalidDefinitionClass()
{
$container = new ContainerBuilder();
$container->register('cache.command.pool_pruner')->addArgument(array());
$container->register(CachePoolPruneCommand::class)->addArgument(array());
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');

$pass = new CachePoolPrunerPass();
Expand Down