You are here

protected function AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues in Drupal 8

Same name in this branch
  1. 8 core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
  2. 8 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php \Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues()
  2. 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 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
    ->drupalGetHeader($header_name);
  if (empty($header_value)) {
    return [];
  }
  else {
    return explode(' ', $header_value);
  }
}