public function GenericCacheBackendUnitTestBase::testDelete in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php \Drupal\system\Tests\Cache\GenericCacheBackendUnitTestBase::testDelete()
Tests Drupal\Core\Cache\CacheBackendInterface::delete().
1 call to GenericCacheBackendUnitTestBase::testDelete()
- ApcuBackendUnitTest::testDelete in core/
modules/ system/ src/ Tests/ Cache/ ApcuBackendUnitTest.php - Tests Drupal\Core\Cache\CacheBackendInterface::delete().
1 method overrides GenericCacheBackendUnitTestBase::testDelete()
- ApcuBackendUnitTest::testDelete in core/
modules/ system/ src/ Tests/ Cache/ ApcuBackendUnitTest.php - Tests Drupal\Core\Cache\CacheBackendInterface::delete().
File
- core/
modules/ system/ src/ Tests/ Cache/ GenericCacheBackendUnitTestBase.php, line 234 - Contains \Drupal\system\Tests\Cache\GenericCacheBackendUnitTestBase.
Class
- GenericCacheBackendUnitTestBase
- Tests any cache backend.
Namespace
Drupal\system\Tests\CacheCode
public function testDelete() {
$backend = $this
->getCacheBackend();
$this
->assertIdentical(FALSE, $backend
->get('test1'), "Backend does not contain data for cache id test1.");
$backend
->set('test1', 7);
$this
->assert(is_object($backend
->get('test1')), "Backend returned an object for cache id test1.");
$this
->assertIdentical(FALSE, $backend
->get('test2'), "Backend does not contain data for cache id test2.");
$backend
->set('test2', 3);
$this
->assert(is_object($backend
->get('test2')), "Backend returned an object for cache id %cid.");
$backend
->delete('test1');
$this
->assertIdentical(FALSE, $backend
->get('test1'), "Backend does not contain data for cache id test1 after deletion.");
$this
->assert(is_object($backend
->get('test2')), "Backend still has an object for cache id test2.");
$backend
->delete('test2');
$this
->assertIdentical(FALSE, $backend
->get('test2'), "Backend does not contain data for cache id test2 after deletion.");
$long_cid = str_repeat('a', 300);
$backend
->set($long_cid, 'test');
$backend
->delete($long_cid);
$this
->assertIdentical(FALSE, $backend
->get($long_cid), "Backend does not contain data for long cache id after deletion.");
}