function HookOrderTest::testSparseHookOrder

Tests hook order when each module has either oop or procedural listeners.

This would detect a possible mistake where we would first collect modules from all procedural and then from all oop implementations, without fixing the order.

File

core/tests/Drupal/KernelTests/Core/Hook/HookOrderTest.php, line 62

Class

HookOrderTest
@group Hook @group legacy

Namespace

Drupal\KernelTests\Core\Hook

Code

public function testSparseHookOrder() : void {
    $this->assertSameCallList([
        // OOP and procedural listeners are correctly intermixed by module
        // order.
'aaa_hook_order_test_sparse_test_hook',
        BHooks::class . '::sparseTestHook',
        'ccc_hook_order_test_sparse_test_hook',
        DHooks::class . '::sparseTestHook',
    ], \Drupal::moduleHandler()->invokeAll('sparse_test_hook'));
}

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