function CacheTestTrait::getDefaultVariationCache

Retrieves the default cache backend as a variation cache.

Return value

\Drupal\Core\Cache\VariationCacheInterface The default cache backend as a variation cache.

2 calls to CacheTestTrait::getDefaultVariationCache()
CacheTestTrait::verifyDefaultCache in core/modules/system/tests/src/Traits/CacheTestTrait.php
Verify that a given default cache entry exists with the correct cache tags.
ShortcutCacheTagsTest::testEntityCreation in core/modules/shortcut/tests/src/Kernel/ShortcutCacheTagsTest.php
Tests that when creating a shortcut, the shortcut set tag is invalidated.

File

core/modules/system/tests/src/Traits/CacheTestTrait.php, line 35

Class

CacheTestTrait
Provides helper methods for interacting with cache backends.

Namespace

Drupal\Tests\system\Traits

Code

protected function getDefaultVariationCache() : VariationCacheInterface {
    
    /** @var \Drupal\Core\Cache\VariationCacheFactoryInterface $variation_cache_factory */
    $variation_cache_factory = \Drupal::service('variation_cache_factory');
    return $variation_cache_factory->get('default');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.