ApcuCacheTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\ApcuCache;
  12. /**
  13. * @group legacy
  14. */
  15. class ApcuCacheTest extends CacheTestCase
  16. {
  17. protected $skippedTests = [
  18. 'testSetTtl' => 'Testing expiration slows down the test suite',
  19. 'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
  20. 'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
  21. ];
  22. public function createSimpleCache($defaultLifetime = 0)
  23. {
  24. if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) || ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) {
  25. $this->markTestSkipped('APCu extension is required.');
  26. }
  27. if ('\\' === \DIRECTORY_SEPARATOR) {
  28. $this->markTestSkipped('Fails transiently on Windows.');
  29. }
  30. return new ApcuCache(str_replace('\\', '.', __CLASS__), $defaultLifetime);
  31. }
  32. }