You are here

protected function AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\system\Tests\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/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php
Ensures that some cache contexts are present in the current response.
AssertPageCacheContextsAndTagsTrait::assertCacheTags in core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php
Ensures that some cache tags are present in the current response.

File

core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php, line 38
Contains \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait.

Class

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

Namespace

Drupal\system\Tests\Cache

Code

protected function getCacheHeaderValues($header_name) {
  $header_value = $this
    ->drupalGetHeader($header_name);
  if (empty($header_value)) {
    return [];
  }
  else {
    return explode(' ', $header_value);
  }
}