Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bug #27135 [FrameworkBundle] Use the correct service id for CachePool…
…PruneCommand in its compiler pass (DemonTPx)

This PR was squashed before being merged into the 3.4 branch (closes #27135).

Discussion
----------

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

… CachePoolPruneCommand in its compiler pass

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27134    <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

32c7ee3 [FrameworkBundle] Use the correct service id for CachePoolPruneCommand in its compiler pass
  • Loading branch information
nicolas-grekas committed May 3, 2018
2 parents 95ceeab + 32c7ee3 commit 100348a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Expand Up @@ -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;
Expand All @@ -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');

Expand All @@ -36,7 +35,7 @@ public function testCompilerPassReplacesCommandArgument()
'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());
Expand Down Expand Up @@ -64,7 +63,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
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();
Expand Down

0 comments on commit 100348a

Please sign in to comment.