diff --git a/core/modules/system/src/Tests/Common/PageRenderTest.php b/core/modules/system/src/Tests/Common/PageRenderTest.php index b76c969..332239c 100644 --- a/core/modules/system/src/Tests/Common/PageRenderTest.php +++ b/core/modules/system/src/Tests/Common/PageRenderTest.php @@ -56,6 +56,7 @@ function assertPageRenderHookExceptions($module, $hook) { // Assert that hooks can set cache tags. $this->assertEqual($page['#cache']['tags'], ['example']); + $this->assertEqual($page['#cache']['contexts'], ['user.permissions']); // Assert an invalid hook implementation doesn't trigger an exception. \Drupal::state()->set($module . '.' . $hook . '.descendant_attached', TRUE); diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module index 21c5261..a6f72a7 100644 --- a/core/modules/system/tests/modules/common_test/common_test.module +++ b/core/modules/system/tests/modules/common_test/common_test.module @@ -225,6 +225,7 @@ function common_test_page_attachments(array &$page) { $page['#attached']['library'][] = 'core/foo'; $page['#attached']['library'][] = 'core/bar'; $page['#cache']['tags'] = ['example']; + $page['#cache']['contexts'] = ['user.permissions']; if (\Drupal::state()->get('common_test.hook_page_attachments.descendant_attached', FALSE)) { $page['content']['#attached']['library'][] = 'core/jquery'; @@ -250,6 +251,7 @@ function common_test_page_attachments_alter(array &$page) { } $page['#attached']['library'][] = 'core/baz'; $page['#cache']['tags'] = ['example']; + $page['#cache']['contexts'] = ['user.permissions']; if (\Drupal::state()->get('common_test.hook_page_attachments_alter.descendant_attached', FALSE)) { $page['content']['#attached']['library'][] = 'core/jquery';