You are here

protected function ApcuBackendUnitTest::getRequirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php \Drupal\system\Tests\Cache\ApcuBackendUnitTest::getRequirements()

Get a list of failed requirements.

This specifically bypasses checkRequirements because it fails tests. PHP 7 does not have APC and simpletest does not have a explicit "skip" functionality so to emulate it we override all test methods and explicitly pass when requirements are not met.

Return value

array

1 call to ApcuBackendUnitTest::getRequirements()
ApcuBackendUnitTest::requirementsFail in core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php
Check if requirements fail.

File

core/modules/system/src/Tests/Cache/ApcuBackendUnitTest.php, line 30
Contains \Drupal\system\Tests\Cache\ApcuBackendUnitTest.

Class

ApcuBackendUnitTest
Tests the APCu cache backend.

Namespace

Drupal\system\Tests\Cache

Code

protected function getRequirements() {
  $requirements = [];
  if (!extension_loaded('apc')) {
    $requirements[] = 'APC extension not found.';
  }
  else {
    if (version_compare(phpversion('apc'), '3.1.1', '<')) {
      $requirements[] = 'APC extension must be newer than 3.1.1 for APCIterator support.';
    }
    if (PHP_SAPI === 'cli' && !ini_get('apc.enable_cli')) {
      $requirements[] = 'apc.enable_cli must be enabled to run this test.';
    }
  }
  return $requirements;
}