function HelpEmptyPageTest::testEmptyHookHelp

Same name in other branches
  1. 9 core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php \Drupal\Tests\help\Kernel\HelpEmptyPageTest::testEmptyHookHelp()
  2. 8.9.x core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php \Drupal\Tests\help\Kernel\HelpEmptyPageTest::testEmptyHookHelp()
  3. 10 core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php \Drupal\Tests\help\Kernel\HelpEmptyPageTest::testEmptyHookHelp()

Ensures that no URL generator is called on a page without hook_help().

File

core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php, line 36

Class

HelpEmptyPageTest
Tests the empty HTML page.

Namespace

Drupal\Tests\help\Kernel

Code

public function testEmptyHookHelp() : void {
    $all_modules = \Drupal::service('extension.list.module')->getList();
    $all_modules = array_filter($all_modules, function ($module) {
        // Filter contrib, hidden, already enabled modules and modules in the
        // Testing package.
        if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
            return FALSE;
        }
        return TRUE;
    });
    $this->enableModules(array_keys($all_modules));
    $this->installEntitySchema('menu_link_content');
    $route = \Drupal::service('router.route_provider')->getRouteByName('<front>');
    \Drupal::service('module_handler')->invokeAll('help', [
        '<front>',
        new RouteMatch('<front>', $route),
    ]);
}

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