livre-1.0.0-beta6/book/tests/modules/book_test/book_test.module
book/tests/modules/book_test/book_test.module
<?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\Tests\book\Functional\BookTest::testBookNavigationCacheContext()
*/
/**
* Implements hook_page_attachments().
*/
function book_test_page_attachments(array &$page): void {
$page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
if (\Drupal::state()->get('book_test.debug_book_navigation_cache_context', FALSE)) {
\Drupal::messenger()->addStatus(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
}
}
/**
* Implements hook_entity_type_build().
*
* @see \Drupal\Tests\book\Functional\BookTest::testBookWithFieldViolations()
*/
function book_test_entity_type_build(array &$entity_types): void {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
$entity_types['node']
->addConstraint('BookTestTitle', []);
}
