You are here

protected function AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues in Drupal 9

Same name and namespace in other branches
  1. 8 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 33

Class

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

Namespace

Drupal\Tests\system\Functional\Cache

Code

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