function AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
  2. 8.9.x core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
  3. 8.9.x core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
  4. 10 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()

Gets a specific header value as array.

Parameters

string $header_name: The header name.

Return value

string[] The header value, potentially exploded by spaces.

2 calls to AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
AssertPageCacheContextsAndTagsTrait::assertCacheContexts in core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php
Ensures that some cache contexts are present in the current response.
AssertPageCacheContextsAndTagsTrait::assertCacheTags in core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php
Ensures that some cache tags are present in the current response.

File

core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php, line 35

Class

AssertPageCacheContextsAndTagsTrait
Provides test assertions for testing page-level cache contexts & tags.

Namespace

Drupal\Tests\system\Functional\Cache

Code

protected function getCacheHeaderValues($header_name) : array {
    $header_value = $this->getSession()
        ->getResponseHeader($header_name);
    return empty($header_value) ? [] : explode(' ', $header_value);
}

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