public function GenericCacheBackendUnitTestBase::testRemoveBin in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php \Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase::testRemoveBin()
- 9 core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php \Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase::testRemoveBin()
Tests Drupal\Core\Cache\CacheBackendInterface::removeBin().
File
- core/
tests/ Drupal/ KernelTests/ Core/ Cache/ GenericCacheBackendUnitTestBase.php, line 626
Class
- GenericCacheBackendUnitTestBase
- Tests any cache backend.
Namespace
Drupal\KernelTests\Core\CacheCode
public function testRemoveBin() {
$backend_a = $this
->getCacheBackend();
$backend_b = $this
->getCacheBackend('bootstrap');
// Set both expiring and permanent keys.
$backend_a
->set('test1', 1, Cache::PERMANENT);
$backend_a
->set('test2', 3, time() + 1000);
$backend_b
->set('test3', 4, Cache::PERMANENT);
$backend_a
->removeBin();
$this
->assertFalse($backend_a
->get('test1'), 'First key has been deleted.');
$this
->assertFalse($backend_a
->get('test2', TRUE), 'Second key has been deleted.');
$this
->assertNotEmpty($backend_b
->get('test3'), 'Item in other bin is preserved.');
}