function ApcuBackendTest::testSetGet

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php \Drupal\KernelTests\Core\Cache\ApcuBackendTest::testSetGet()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php \Drupal\KernelTests\Core\Cache\ApcuBackendTest::testSetGet()
  3. 11.x 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 38

Class

ApcuBackendTest
Tests the APCu cache backend.

Namespace

Drupal\KernelTests\Core\Cache

Code

public function testSetGet() : void {
  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->assertEquals(0, $item['ttl']);
    $found = TRUE;
  }
  $this->assertTrue($found);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.