function ApcuBackendTest::testSetGet

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

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->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.