ApcuCacheTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. class ApcuCacheTest extends CacheTestCase
  13. {
  14. protected $skippedTests = [
  15. 'testSetTtl' => 'Testing expiration slows down the test suite',
  16. 'testSetMultipleTtl' => 'Testing expiration slows down the test suite',
  17. 'testDefaultLifeTime' => 'Testing expiration slows down the test suite',
  18. ];
  19. public function createSimpleCache($defaultLifetime = 0)
  20. {
  21. 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))) {
  22. $this->markTestSkipped('APCu extension is required.');
  23. }
  24. if ('\\' === \DIRECTORY_SEPARATOR) {
  25. $this->markTestSkipped('Fails transiently on Windows.');
  26. }
  27. return new ApcuCache(str_replace('\\', '.', __CLASS__), $defaultLifetime);
  28. }
  29. }