Same filename and directory in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
- 9 core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
Namespace
Drupal\KernelTests\Core\Cache
File
core/tests/Drupal/KernelTests/Core/Cache/ApcuBackendTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\KernelTests\Core\Cache;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\ApcuBackend;
class ApcuBackendTest extends GenericCacheBackendUnitTestBase {
protected function createCacheBackend($bin) {
return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'), \Drupal::service(TimeInterface::class));
}
protected function tearDown() : void {
foreach ($this->cacheBackends as $bin => $cache_backend) {
$this->cacheBackends[$bin]
->removeBin();
}
parent::tearDown();
}
public function testSetGet() {
parent::testSetGet();
$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);
}
}
Classes