1717use Symfony \Component \Cache \Adapter \ChainAdapter ;
1818use Symfony \Component \Cache \Adapter \NullAdapter ;
1919use Symfony \Component \Cache \Adapter \RedisAdapter ;
20+ use Symfony \Component \Cache \Adapter \TagAwareAdapter ;
2021use Symfony \Component \Cache \DependencyInjection \CachePoolPass ;
2122use Symfony \Component \DependencyInjection \ChildDefinition ;
2223use Symfony \Component \DependencyInjection \ContainerBuilder ;
@@ -102,15 +103,18 @@ public function testNamespaceArgumentIsSeededWithAdapterClassNameWithoutAffectin
102103 $ this ->assertSame ('xmOJ8gqF-Y ' , $ cachePool ->getArgument (0 ));
103104 }
104105
105- public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed ()
106+ /**
107+ * @dataProvider providerAdaptersNotNamespace
108+ */
109+ public function testNamespaceArgumentIsNotReplacedIfAdapterWithoutNamespace (string $ adapterClass )
106110 {
107111 $ container = new ContainerBuilder ();
108112 $ container ->setParameter ('kernel.container_class ' , 'app ' );
109113 $ container ->setParameter ('kernel.project_dir ' , 'foo ' );
110114
111- $ container ->register ('cache.adapter.array ' , ArrayAdapter::class )->addArgument (0 );
115+ $ container ->register ('cache.adapter ' , $ adapterClass )->addArgument (0 );
112116
113- $ cachePool = new ChildDefinition ('cache.adapter.array ' );
117+ $ cachePool = new ChildDefinition ('cache.adapter ' );
114118 $ cachePool ->addTag ('cache.pool ' );
115119 $ container ->setDefinition ('app.cache_pool ' , $ cachePool );
116120
@@ -119,21 +123,11 @@ public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
119123 $ this ->assertCount (0 , $ container ->getDefinition ('app.cache_pool ' )->getArguments ());
120124 }
121125
122- public function testNamespaceArgumentIsNotReplacedIfNullAdapterIsUsed ()
126+ public static function providerAdaptersNotNamespace (): iterable
123127 {
124- $ container = new ContainerBuilder ();
125- $ container ->setParameter ('kernel.container_class ' , 'app ' );
126- $ container ->setParameter ('kernel.project_dir ' , 'foo ' );
127-
128- $ container ->register ('cache.adapter.null ' , NullAdapter::class);
129-
130- $ cachePool = new ChildDefinition ('cache.adapter.null ' );
131- $ cachePool ->addTag ('cache.pool ' );
132- $ container ->setDefinition ('app.cache_pool ' , $ cachePool );
133-
134- $ this ->cachePoolPass ->process ($ container );
135-
136- $ this ->assertCount (0 , $ container ->getDefinition ('app.cache_pool ' )->getArguments ());
128+ yield [ArrayAdapter::class];
129+ yield [NullAdapter::class];
130+ yield [TagAwareAdapter::class];
137131 }
138132
139133 public function testArgsAreReplaced ()
0 commit comments