function CacheTestTrait::verifyCache
Verify that a given cache entry exists, with the correct cache tags.
Parameters
\Drupal\Core\Cache\VariationCacheInterface $cache_bin: The cache bin to check.
string[] $keys: The cache item keys.
array $tags: An array of expected cache tags.
\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The initial cacheability for the item.
2 calls to CacheTestTrait::verifyCache()
- CacheTestTrait::verifyDefaultCache in core/
modules/ system/ tests/ src/ Traits/ CacheTestTrait.php - Verify that a given default cache entry exists with the correct cache tags.
- CacheTestTrait::verifyRenderCache in core/
modules/ system/ tests/ src/ Traits/ CacheTestTrait.php - Verify that a given render cache entry exists with the correct cache tags.
File
-
core/
modules/ system/ tests/ src/ Traits/ CacheTestTrait.php, line 81
Class
- CacheTestTrait
- Provides helper methods for interacting with cache backends.
Namespace
Drupal\Tests\system\TraitsCode
private function verifyCache(VariationCacheInterface $cache_bin, array $keys, array $tags, CacheableDependencyInterface $cacheability) : void {
$cache_entry = $cache_bin->get($keys, $cacheability);
$this->assertInstanceOf(\stdClass::class, $cache_entry);
sort($cache_entry->tags);
sort($tags);
$this->assertSame($cache_entry->tags, $tags);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.