|
29 | 29 | use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
30 | 30 | use Symfony\Component\Cache\Adapter\RedisAdapter;
|
31 | 31 | use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
|
| 32 | +use Symfony\Component\Cache\Adapter\TagAwareAdapter; |
32 | 33 | use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
|
33 | 34 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
34 | 35 | use Symfony\Component\DependencyInjection\ChildDefinition;
|
@@ -1388,6 +1389,17 @@ public function testCachePoolServices()
|
1388 | 1389 | 12,
|
1389 | 1390 | ];
|
1390 | 1391 | $this->assertEquals($expected, $chain->getArguments());
|
| 1392 | + |
| 1393 | + // Test "tags: true" wrapping logic |
| 1394 | + $tagAwareDefinition = $container->getDefinition('cache.ccc'); |
| 1395 | + $this->assertSame(TagAwareAdapter::class, $tagAwareDefinition->getClass()); |
| 1396 | + $this->assertCachePoolServiceDefinitionIsCreated($container, (string) $tagAwareDefinition->getArgument(0), 'cache.adapter.array', 410); |
| 1397 | + |
| 1398 | + if (method_exists(TagAwareAdapter::class, 'setLogger')) { |
| 1399 | + $this->assertEquals([ |
| 1400 | + ['setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]], |
| 1401 | + ], $tagAwareDefinition->getMethodCalls()); |
| 1402 | + } |
1391 | 1403 | }
|
1392 | 1404 |
|
1393 | 1405 | public function testRedisTagAwareAdapter()
|
@@ -1786,6 +1798,9 @@ private function assertCachePoolServiceDefinitionIsCreated(ContainerBuilder $con
|
1786 | 1798 | case 'cache.adapter.redis':
|
1787 | 1799 | $this->assertSame(RedisAdapter::class, $parentDefinition->getClass());
|
1788 | 1800 | break;
|
| 1801 | + case 'cache.adapter.array': |
| 1802 | + $this->assertSame(ArrayAdapter::class, $parentDefinition->getClass()); |
| 1803 | + break; |
1789 | 1804 | default:
|
1790 | 1805 | $this->fail('Unresolved adapter: '.$adapter);
|
1791 | 1806 | }
|
|
0 commit comments