public function testPoolRefsAreWeak()
 {
     $container = new ContainerBuilder();
     $container->setParameter('kernel.debug', false);
     $container->setParameter('kernel.name', 'app');
     $container->setParameter('kernel.environment', 'prod');
     $container->setParameter('kernel.root_dir', 'foo');
     $globalClearer = new Definition(Psr6CacheClearer::class);
     $container->setDefinition('cache.global_clearer', $globalClearer);
     $publicPool = new Definition();
     $publicPool->addArgument('namespace');
     $publicPool->addTag('cache.pool', array('clearer' => 'clearer_alias'));
     $container->setDefinition('public.pool', $publicPool);
     $privatePool = new Definition();
     $privatePool->setPublic(false);
     $privatePool->addArgument('namespace');
     $privatePool->addTag('cache.pool', array('clearer' => 'clearer_alias'));
     $container->setDefinition('private.pool', $privatePool);
     $clearer = new Definition();
     $container->setDefinition('clearer', $clearer);
     $container->setAlias('clearer_alias', 'clearer');
     $pass = new RemoveUnusedDefinitionsPass();
     $pass->setRepeatedPass(new RepeatedPass(array($pass)));
     foreach (array(new CachePoolPass(), $pass, new CachePoolClearerPass()) as $pass) {
         $pass->process($container);
     }
     $this->assertEquals(array(array('public.pool' => new Reference('public.pool'))), $clearer->getArguments());
     $this->assertEquals(array(array('public.pool' => new Reference('public.pool'))), $globalClearer->getArguments());
 }
 public function testPoolRefsAreWeak()
 {
     $container = new ContainerBuilder();
     $publicPool = new Definition();
     $publicPool->addArgument('namespace');
     $publicPool->addTag('cache.pool', array('clearer' => 'clearer_alias'));
     $container->setDefinition('public.pool', $publicPool);
     $privatePool = new Definition();
     $privatePool->setPublic(false);
     $privatePool->addArgument('namespace');
     $privatePool->addTag('cache.pool', array('clearer' => 'clearer_alias'));
     $container->setDefinition('private.pool', $privatePool);
     $clearer = new Definition();
     $container->setDefinition('clearer', $clearer);
     $container->setAlias('clearer_alias', 'clearer');
     $pass = new RemoveUnusedDefinitionsPass();
     $pass->setRepeatedPass(new RepeatedPass(array($pass)));
     foreach (array(new CachePoolPass(), $pass, new CachePoolClearerPass()) as $pass) {
         $pass->process($container);
     }
     $this->assertEquals(array(array('addPool', array(new Reference('public.pool')))), $clearer->getMethodCalls());
 }