|
26 | 26 | use Symfony\Component\Cache\Adapter\FilesystemAdapter; |
27 | 27 | use Symfony\Component\Cache\Adapter\ProxyAdapter; |
28 | 28 | use Symfony\Component\Cache\Adapter\RedisAdapter; |
| 29 | +use Symfony\Component\Cache\Adapter\TagAwareAdapter; |
29 | 30 | use Symfony\Component\Cache\DependencyInjection\CachePoolPass; |
30 | 31 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; |
31 | 32 | use Symfony\Component\DependencyInjection\ChildDefinition; |
@@ -1504,6 +1505,17 @@ public function testCachePoolServices() |
1504 | 1505 | 12, |
1505 | 1506 | ]; |
1506 | 1507 | $this->assertEquals($expected, $chain->getArguments()); |
| 1508 | + |
| 1509 | + // Test "tags: true" wrapping logic |
| 1510 | + $tagAwareDefinition = $container->getDefinition('cache.ccc'); |
| 1511 | + $this->assertSame(TagAwareAdapter::class, $tagAwareDefinition->getClass()); |
| 1512 | + $this->assertCachePoolServiceDefinitionIsCreated($container, (string) $tagAwareDefinition->getArgument(0), 'cache.adapter.array', 410); |
| 1513 | + |
| 1514 | + if (method_exists(TagAwareAdapter::class, 'setLogger')) { |
| 1515 | + $this->assertEquals([ |
| 1516 | + ['setLogger', [new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]], |
| 1517 | + ], $tagAwareDefinition->getMethodCalls()); |
| 1518 | + } |
1507 | 1519 | } |
1508 | 1520 |
|
1509 | 1521 | public function testRemovesResourceCheckerConfigCacheFactoryArgumentOnlyIfNoDebug() |
@@ -1813,6 +1825,9 @@ private function assertCachePoolServiceDefinitionIsCreated(ContainerBuilder $con |
1813 | 1825 | case 'cache.adapter.redis': |
1814 | 1826 | $this->assertSame(RedisAdapter::class, $parentDefinition->getClass()); |
1815 | 1827 | break; |
| 1828 | + case 'cache.adapter.array': |
| 1829 | + $this->assertSame(ArrayAdapter::class, $parentDefinition->getClass()); |
| 1830 | + break; |
1816 | 1831 | default: |
1817 | 1832 | $this->fail('Unresolved adapter: '.$adapter); |
1818 | 1833 | } |
|
0 commit comments