public function PermanentDatabaseBackendTest::testDeleteAll in Permanent Cache Bin 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/PermanentDatabaseBackendTest.php \Drupal\Tests\pcb\Kernel\PermanentDatabaseBackendTest::testDeleteAll()
Test Drupal\Core\Cache\CacheBackendInterface::deleteAll().
Overrides GenericCacheBackendUnitTestBase::testDeleteAll
File
- tests/
src/ Kernel/ PermanentDatabaseBackendTest.php, line 39
Class
- PermanentDatabaseBackendTest
- Tests the PermanentDatabaseBackendTest.
Namespace
Drupal\Tests\pcb\KernelCode
public function testDeleteAll() {
$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
->deleteAll();
// We don't delete on deleteAll(). Keys should be here.
$this
->assertSame(1, $backend_a
->get('test1')->data ?? NULL, 'First key has been deleted.');
$this
->assertSame(3, $backend_a
->get('test2')->data ?? NULL, 'Second key has been deleted.');
$this
->assertSame(4, $backend_b
->get('test3')->data ?? NULL, 'Item in other bin is preserved.');
}