Commit 52f2a292 authored by alexpott's avatar alexpott

Issue #2795579 by martin107, klausi, dawehner: Adapt assertCacheContexts to...

Issue #2795579 by martin107, klausi, dawehner: Adapt assertCacheContexts to not rely on the return value of assertIdentical
parent e8885ed6
......@@ -142,7 +142,7 @@ protected function assertCacheTags(array $expected_tags, $include_default_tags =
* @param bool $include_default_contexts
* (optional) Whether the default contexts should automatically be included.
*
* @return
* @return bool
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertCacheContexts(array $expected_contexts, $message = NULL, $include_default_contexts = TRUE) {
......@@ -159,12 +159,17 @@ protected function assertCacheContexts(array $expected_contexts, $message = NULL
$actual_contexts = $this->getCacheHeaderValues('X-Drupal-Cache-Contexts');
sort($expected_contexts);
sort($actual_contexts);
$return = $this->assertIdentical($actual_contexts, $expected_contexts, $message);
if (!$return) {
$match = $actual_contexts === $expected_contexts;
if (!$match) {
debug('Unwanted cache contexts in response: ' . implode(',', array_diff($actual_contexts, $expected_contexts)));
debug('Missing cache contexts in response: ' . implode(',', array_diff($expected_contexts, $actual_contexts)));
}
return $return;
$this->assertIdentical($actual_contexts, $expected_contexts, $message);
// For compatibility with both BrowserTestBase and WebTestBase always return
// a boolean.
return $match;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment