PhpArrayAdapterWithFallbackTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\FilesystemAdapter;
  12. use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
  13. /**
  14. * @group time-sensitive
  15. */
  16. class PhpArrayAdapterWithFallbackTest extends AdapterTestCase
  17. {
  18. protected $skippedTests = [
  19. 'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
  20. 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
  21. 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
  22. 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
  23. 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.',
  24. 'testPrune' => 'PhpArrayAdapter just proxies',
  25. ];
  26. protected static $file;
  27. public static function setUpBeforeClass()
  28. {
  29. self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
  30. }
  31. protected function tearDown()
  32. {
  33. $this->createCachePool()->clear();
  34. if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
  35. FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
  36. }
  37. }
  38. public function createCachePool($defaultLifetime = 0)
  39. {
  40. return new PhpArrayAdapter(self::$file, new FilesystemAdapter('php-array-fallback', $defaultLifetime));
  41. }
  42. }