Skip to content

Commit a03eaf0

Browse files
authored
Merge pull request #30 from mortola/fix/cache
Fix setting PSR-16 cache provider
2 parents 88c9c61 + e9686d6 commit a03eaf0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

DependencyInjection/FlorianvSwapExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function configureCacheService(ContainerBuilder $container, array $config
102102
throw new InvalidArgumentException("Cache class $class does not exist.");
103103
}
104104

105-
$definition = new Definition($class, $arguments);
105+
$definition = new Definition('Symfony\Component\Cache\Psr16Cache', [new Definition($class, $arguments)]);
106106
$definition->setPublic(false);
107107
$container->setDefinition($id, $definition);
108108
} elseif ($container->hasDefinition($type)) {

Tests/DependencyInjection/FlorianvSwapExtensionTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ private function assertCache($class, $config)
172172

173173
/** @var Definition */
174174
$cacheDefinition = $this->container->getDefinition('florianv_swap.cache');
175-
$this->assertEquals($cacheDefinition->getClass(), $class);
175+
$this->assertEquals($cacheDefinition->getClass(), 'Symfony\Component\Cache\Psr16Cache');
176+
$this->assertEquals($cacheDefinition->getArgument(0)->getClass(), $class);
176177
$this->assertFalse($cacheDefinition->isPublic());
177178

178-
$this->assertEquals($config, $cacheDefinition->getArguments());
179+
$this->assertEquals($config, $cacheDefinition->getArgument(0)->getArguments());
179180

180181
$cache = $this->container->get('florianv_swap.cache');
181-
$this->assertInstanceOf($class, $cache);
182+
$this->assertInstanceOf('Symfony\Component\Cache\Psr16Cache', $cache);
182183
}
183184
}

0 commit comments

Comments
 (0)