protected function VariationCacheTest::assertVariationCacheItem in VariationCache 8
Asserts that an item was properly stored in the variation cache.
Parameters
mixed $data: The data that should have been stored.
\Drupal\Core\Cache\CacheableMetadata $cacheability: The cacheability that should have been used.
\Drupal\Core\Cache\CacheableMetadata $initial_cacheability: The initial cacheability that should be used.
4 calls to VariationCacheTest::assertVariationCacheItem()
- VariationCacheTest::testNestedVariations in tests/
src/ Unit/ VariationCacheTest.php - Tests a cache item that has nested variations.
- VariationCacheTest::testNestedVariationsSelfHealing in tests/
src/ Unit/ VariationCacheTest.php - Tests a cache item that has nested variations that trigger self-healing.
- VariationCacheTest::testNoVariations in tests/
src/ Unit/ VariationCacheTest.php - Tests a cache item that has no variations.
- VariationCacheTest::testSingleVariation in tests/
src/ Unit/ VariationCacheTest.php - Tests a cache item that only ever varies by one context.
File
- tests/
src/ Unit/ VariationCacheTest.php, line 436
Class
- VariationCacheTest
- @coversDefaultClass \Drupal\variationcache\Cache\VariationCache @group Cache
Namespace
Drupal\Tests\variationcache\UnitCode
protected function assertVariationCacheItem($data, CacheableMetadata $cacheability, CacheableMetadata $initial_cacheability) {
$cache_item = $this->variationCache
->get($this->cacheKeys, $initial_cacheability);
$this
->assertNotFalse($cache_item, 'Variable data was stored and retrieved successfully.');
$this
->assertEquals($data, $cache_item->data, 'Variable cache item contains the right data.');
$this
->assertSame($cacheability
->getCacheTags(), $cache_item->tags, 'Variable cache item uses the right cache tags.');
}