You are here

public function ApcuBackendTest::testSetGet in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php \Drupal\KernelTests\Core\Cache\ApcuBackendTest::testSetGet()
  2. 10 core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php \Drupal\KernelTests\Core\Cache\ApcuBackendTest::testSetGet()

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

Overrides GenericCacheBackendUnitTestBase::testSetGet

File

core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php, line 35

Class

ApcuBackendTest
Tests the APCu cache backend.

Namespace

Drupal\KernelTests\Core\Cache

Code

public function testSetGet() {
  parent::testSetGet();

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