Psr16AdapterTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Cache\Tests\Adapter;
  11. use Symfony\Component\Cache\Adapter\ArrayAdapter;
  12. use Symfony\Component\Cache\Adapter\FilesystemAdapter;
  13. use Symfony\Component\Cache\Adapter\Psr16Adapter;
  14. use Symfony\Component\Cache\Psr16Cache;
  15. /**
  16. * @group time-sensitive
  17. */
  18. class Psr16AdapterTest extends AdapterTestCase
  19. {
  20. protected $skippedTests = [
  21. 'testPrune' => 'Psr16adapter just proxies',
  22. ];
  23. public function createCachePool($defaultLifetime = 0)
  24. {
  25. return new Psr16Adapter(new Psr16Cache(new FilesystemAdapter()), '', $defaultLifetime);
  26. }
  27. public function testValidCacheKeyWithNamespace()
  28. {
  29. $cache = new Psr16Adapter(new Psr16Cache(new ArrayAdapter()), 'some_namespace', 0);
  30. $item = $cache->getItem('my_key');
  31. $item->set('someValue');
  32. $cache->save($item);
  33. $this->assertTrue($cache->getItem('my_key')->isHit(), 'Stored item is successfully retrieved.');
  34. }
  35. }