|
30 | 30 | use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
31 | 31 | use Symfony\Component\Cache\Adapter\RedisAdapter;
|
32 | 32 | use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
|
| 33 | +use Symfony\Component\Cache\Adapter\TagAwareAdapter; |
33 | 34 | use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
|
34 | 35 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
35 | 36 | use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
@@ -1537,6 +1538,17 @@ public function testCachePoolServices()
|
1537 | 1538 | 12,
|
1538 | 1539 | ];
|
1539 | 1540 | $this->assertEquals($expected, $chain->getArguments());
|
| 1541 | + |
| 1542 | + // Test "tags: true" wrapping logic |
| 1543 | + $tagAwareDefinition = $container->getDefinition('cache.ccc'); |
| 1544 | + $this->assertSame(TagAwareAdapter::class, $tagAwareDefinition->getClass()); |
| 1545 | + $this->assertCachePoolServiceDefinitionIsCreated($container, (string) $tagAwareDefinition->getArgument(0), 'cache.adapter.array', 410); |
| 1546 | + |
| 1547 | + if (method_exists(TagAwareAdapter::class, 'setLogger')) { |
| 1548 | + $this->assertEquals([ |
| 1549 | + ['setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]], |
| 1550 | + ], $tagAwareDefinition->getMethodCalls()); |
| 1551 | + } |
1540 | 1552 | }
|
1541 | 1553 |
|
1542 | 1554 | public function testRedisTagAwareAdapter()
|
@@ -1948,6 +1960,9 @@ private function assertCachePoolServiceDefinitionIsCreated(ContainerBuilder $con
|
1948 | 1960 | case 'cache.adapter.redis':
|
1949 | 1961 | $this->assertSame(RedisAdapter::class, $parentDefinition->getClass());
|
1950 | 1962 | break;
|
| 1963 | + case 'cache.adapter.array': |
| 1964 | + $this->assertSame(ArrayAdapter::class, $parentDefinition->getClass()); |
| 1965 | + break; |
1951 | 1966 | default:
|
1952 | 1967 | $this->fail('Unresolved adapter: '.$adapter);
|
1953 | 1968 | }
|
|
0 commit comments