class CHooks

Provides hook implementations for testing the execution order of hooks.

By default, these will be called in module order, which is predictable due to the alphabetical module names.

Hierarchy

  • class \Drupal\ccc_hook_order_test\Hook\CHooks

Expanded class hierarchy of CHooks

See also

\Drupal\KernelTests\Core\Hook\HookOrderTest::testHookOrder()

\Drupal\KernelTests\Core\Hook\HookOrderTest::testBothParametersHookOrder()

3 files declare their use of CHooks
AHooks.php in core/modules/system/tests/modules/HookOrder/aaa_hook_order_test/src/Hook/AHooks.php
DHooks.php in core/modules/system/tests/modules/HookOrder/ddd_hook_order_test/src/Hook/DHooks.php
HookOrderTest.php in core/tests/Drupal/KernelTests/Core/Hook/HookOrderTest.php

File

core/modules/system/tests/modules/HookOrder/ccc_hook_order_test/src/Hook/CHooks.php, line 19

Namespace

Drupal\ccc_hook_order_test\Hook
View source
class CHooks {
  
  /**
   * Implements hook_test_hook().
   *
   * This implementation has no ordering modifications.
   */
  public function testHook() : string {
    return __METHOD__;
  }
  
  /**
   * Implements hook_test_hook().
   *
   * This implementation is modified to be first.
   */
  public function testHookFirst() : string {
    return __METHOD__;
  }
  
  /**
   * Implements hook_test_hook().
   *
   * This implementation is modified in class
   * \Drupal\ddd_hook_order_test\Hook\DHooks to be first.
   *
   * @see \Drupal\ddd_hook_order_test\Hook\DHooks
   */
  public function testHookReorderFirst() : string {
    return __METHOD__;
  }
  
  /**
   * Implements hook_test_hook().
   *
   * This implementation is removed in class
   * \Drupal\ddd_hook_order_test\Hook\DHooks.
   *
   * @see \Drupal\ddd_hook_order_test\Hook\DHooks
   */
  public function testHookRemoved() : string {
    return __METHOD__;
  }
  
  /**
   * Implements hook_test_hook().
   *
   * This implementation is modified in
   * \Drupal\aaa_hook_order_test\Hook\AHooks::testBothParametersHook using the
   * OrderAfter attribute.
   */
  public function testBothParametersHook() : string {
    return __METHOD__;
  }

}

Members

Title Sort descending Modifiers Object type Summary
CHooks::testBothParametersHook public function Implements hook_test_hook().
CHooks::testHook public function Implements hook_test_hook().
CHooks::testHookFirst public function Implements hook_test_hook().
CHooks::testHookRemoved public function Implements hook_test_hook().
CHooks::testHookReorderFirst public function Implements hook_test_hook().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.