You are here

public function ApcuBackendUnitTest::testSetGet in Zircon Profile 8.0

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

Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.

Overrides GenericCacheBackendUnitTestBase::testSetGet

File

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

Class

ApcuBackendUnitTest
Tests the APCu cache backend.

Namespace

Drupal\system\Tests\Cache

Code

public function testSetGet() {
  if ($this
    ->requirementsFail()) {
    return;
  }
  parent::testSetGet();

  // Make sure entries are permanent (i.e. no TTL).
  $backend = $this
    ->getCacheBackend($this
    ->getTestBin());
  $key = $backend
    ->getApcuKey('TEST8');
  foreach (new \APCIterator('user', '/^' . $key . '/') as $item) {
    $this
      ->assertEqual(0, $item['ttl']);
    $found = TRUE;
  }
  $this
    ->assertTrue($found);
}