1. 8.5.x core/modules/book/tests/modules/book_test/book_test.module
  2. 8.0.x core/modules/book/tests/modules/book_test/book_test.module
  3. 8.1.x core/modules/book/tests/modules/book_test/book_test.module
  4. 8.2.x core/modules/book/tests/modules/book_test/book_test.module
  5. 8.3.x core/modules/book/tests/modules/book_test/book_test.module
  6. 8.4.x core/modules/book/tests/modules/book_test/book_test.module
  7. 8.6.x core/modules/book/tests/modules/book_test/book_test.module

Test module for testing the book module.

This module's functionality depends on the following state variables:

  • book_test.debug_book_navigation_cache_context: Used in NodeQueryAlterTest to enable the node_access_all grant realm.

See also

\Drupal\book\Tests\BookTest::testBookNavigationCacheContext()

File

core/modules/book/tests/modules/book_test/book_test.module
View source
<?php

/**
 * @file
 * Test module for testing the book module.
 *
 * This module's functionality depends on the following state variables:
 * - book_test.debug_book_navigation_cache_context: Used in NodeQueryAlterTest to enable the
 *   node_access_all grant realm.
 *
 * @see \Drupal\book\Tests\BookTest::testBookNavigationCacheContext()
 */

/**
 * Implements hook_page_attachments().
 */
function book_test_page_attachments(array &$page) {
  $page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
  if (\Drupal::state()
    ->get('book_test.debug_book_navigation_cache_context', FALSE)) {
    drupal_set_message(\Drupal::service('cache_contexts_manager')
      ->convertTokensToKeys([
      'route.book_navigation',
    ])
      ->getKeys()[0]);
  }
}

Functions