PhpArrayCacheWithFallbackTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\Simple;
  11. use Symfony\Component\Cache\Simple\FilesystemCache;
  12. use Symfony\Component\Cache\Simple\PhpArrayCache;
  13. use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest;
  14. /**
  15. * @group time-sensitive
  16. */
  17. class PhpArrayCacheWithFallbackTest extends CacheTestCase
  18. {
  19. protected $skippedTests = [
  20. 'testGetInvalidKeys' => 'PhpArrayCache does no validation',
  21. 'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  22. 'testDeleteInvalidKeys' => 'PhpArrayCache does no validation',
  23. 'testDeleteMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  24. //'testSetValidData' => 'PhpArrayCache does no validation',
  25. 'testSetInvalidKeys' => 'PhpArrayCache does no validation',
  26. 'testSetInvalidTtl' => 'PhpArrayCache does no validation',
  27. 'testSetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  28. 'testSetMultipleInvalidTtl' => 'PhpArrayCache does no validation',
  29. 'testHasInvalidKeys' => 'PhpArrayCache does no validation',
  30. 'testPrune' => 'PhpArrayCache just proxies',
  31. ];
  32. protected static $file;
  33. public static function setUpBeforeClass()
  34. {
  35. self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
  36. }
  37. protected function tearDown()
  38. {
  39. $this->createSimpleCache()->clear();
  40. if (file_exists(sys_get_temp_dir().'/symfony-cache')) {
  41. FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
  42. }
  43. }
  44. public function createSimpleCache($defaultLifetime = 0)
  45. {
  46. return new PhpArrayCache(self::$file, new FilesystemCache('php-array-fallback', $defaultLifetime));
  47. }
  48. }