PhpArrayCacheWithFallbackTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. * @group legacy
  17. */
  18. class PhpArrayCacheWithFallbackTest extends CacheTestCase
  19. {
  20. protected $skippedTests = [
  21. 'testGetInvalidKeys' => 'PhpArrayCache does no validation',
  22. 'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  23. 'testDeleteInvalidKeys' => 'PhpArrayCache does no validation',
  24. 'testDeleteMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  25. //'testSetValidData' => 'PhpArrayCache does no validation',
  26. 'testSetInvalidKeys' => 'PhpArrayCache does no validation',
  27. 'testSetInvalidTtl' => 'PhpArrayCache does no validation',
  28. 'testSetMultipleInvalidKeys' => 'PhpArrayCache does no validation',
  29. 'testSetMultipleInvalidTtl' => 'PhpArrayCache does no validation',
  30. 'testHasInvalidKeys' => 'PhpArrayCache does no validation',
  31. 'testPrune' => 'PhpArrayCache just proxies',
  32. ];
  33. protected static $file;
  34. public static function setUpBeforeClass(): void
  35. {
  36. self::$file = sys_get_temp_dir().'/symfony-cache/php-array-adapter-test.php';
  37. }
  38. protected function tearDown(): void
  39. {
  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. }