function VariationCacheTest::testNoVariations

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php \Drupal\Tests\Core\Cache\VariationCacheTest::testNoVariations()

Tests a cache item that has no variations.

@covers ::get @covers ::set

File

core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php, line 187

Class

VariationCacheTest
@coversDefaultClass \Drupal\Core\Cache\VariationCache @group Cache

Namespace

Drupal\Tests\Core\Cache

Code

public function testNoVariations() : void {
    $data = 'You have a nice house!';
    $cacheability = (new CacheableMetadata())->setCacheTags([
        'bar',
        'foo',
    ]);
    $initial_cacheability = (new CacheableMetadata())->setCacheTags([
        'foo',
    ]);
    $this->setVariationCacheItem($data, $cacheability, $initial_cacheability);
    $this->assertVariationCacheItem($data, $cacheability, $initial_cacheability);
}

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