PhpFilesAdapterTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 Psr\Cache\CacheItemPoolInterface;
  12. use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
  13. /**
  14. * @group time-sensitive
  15. */
  16. class PhpFilesAdapterTest extends AdapterTestCase
  17. {
  18. protected $skippedTests = [
  19. 'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
  20. ];
  21. public function createCachePool()
  22. {
  23. return new PhpFilesAdapter('sf-cache');
  24. }
  25. public static function tearDownAfterClass(): void
  26. {
  27. FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
  28. }
  29. protected function isPruned(CacheItemPoolInterface $cache, $name)
  30. {
  31. $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile');
  32. $getFileMethod->setAccessible(true);
  33. return !file_exists($getFileMethod->invoke($cache, $name));
  34. }
  35. }