SimpleCacheAdapterTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\SimpleCacheAdapter;
  12. use Symfony\Component\Cache\Simple\ArrayCache;
  13. use Symfony\Component\Cache\Simple\FilesystemCache;
  14. /**
  15. * @group time-sensitive
  16. */
  17. class SimpleCacheAdapterTest extends AdapterTestCase
  18. {
  19. protected $skippedTests = [
  20. 'testPrune' => 'SimpleCache just proxies',
  21. ];
  22. public function createCachePool($defaultLifetime = 0)
  23. {
  24. return new SimpleCacheAdapter(new FilesystemCache(), '', $defaultLifetime);
  25. }
  26. public function testValidCacheKeyWithNamespace()
  27. {
  28. $cache = new SimpleCacheAdapter(new ArrayCache(), 'some_namespace', 0);
  29. $item = $cache->getItem('my_key');
  30. $item->set('someValue');
  31. $cache->save($item);
  32. $this->assertTrue($cache->getItem('my_key')->isHit(), 'Stored item is successfully retrieved.');
  33. }
  34. }