function CacheTestTrait::getDefaultVariationCache

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Traits/CacheTestTrait.php \Drupal\Tests\system\Traits\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.

1 call to CacheTestTrait::getDefaultVariationCache()
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.