Skip to content

Commit

Permalink
Adding a failing test for Psr16Adapter + namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Jun 13, 2019
1 parent 1c1d6d9 commit 500fba8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\Psr16Adapter;
use Symfony\Component\Cache\Psr16Cache;
use Symfony\Component\Debug\BufferingLogger;

/**
* @group time-sensitive
Expand All @@ -28,4 +29,20 @@ public function createCachePool($defaultLifetime = 0)
{
return new Psr16Adapter(new Psr16Cache(new FilesystemAdapter()), '', $defaultLifetime);
}

public function testValidCacheKeyWithNamespace()
{
$logger = new BufferingLogger();
$cache = new Psr16Adapter(new Psr16Cache(new FilesystemAdapter()), 'some_namespace', 0);
$cache->setLogger($logger);
$this->assertSame('foo', $cache->get('my_key', function () {
return 'foo';
}));
$logs = $logger->cleanLogs();
foreach ($logs as $log) {
if ('warning' === $log[0] || 'error' === $log[0]) {
$this->fail('An error was triggered while caching key with a namespace: '.$log[1]);
}
}
}
}

0 comments on commit 500fba8

Please sign in to comment.