function CacheTestBase::checkCacheExists
Same name in this branch
- 8.9.x core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::checkCacheExists()
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::checkCacheExists()
- 10 core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::checkCacheExists()
- 11.x core/modules/system/tests/src/Functional/Cache/CacheTestBase.php \Drupal\Tests\system\Functional\Cache\CacheTestBase::checkCacheExists()
Checks whether or not a cache entry exists.
Parameters
$cid: The cache id.
$var: The variable the cache should contain.
$bin: The bin the cache item was stored in.
Return value
TRUE on pass, FALSE on fail.
1 call to CacheTestBase::checkCacheExists()
- CacheTestBase::assertCacheExists in core/
modules/ system/ src/ Tests/ Cache/ CacheTestBase.php - Asserts that a cache entry exists.
File
-
core/
modules/ system/ src/ Tests/ Cache/ CacheTestBase.php, line 36
Class
- CacheTestBase
- Provides helper methods for cache tests.
Namespace
Drupal\system\Tests\CacheCode
protected function checkCacheExists($cid, $var, $bin = NULL) {
if ($bin == NULL) {
$bin = $this->defaultBin;
}
$cached = \Drupal::cache($bin)->get($cid);
return isset($cached->data) && $cached->data == $var;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.