You are here

public function HelpEmptyPageTest::testEmptyHookHelp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/help/src/Tests/HelpEmptyPageTest.php \Drupal\help\Tests\HelpEmptyPageTest::testEmptyHookHelp()

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

File

core/modules/help/src/Tests/HelpEmptyPageTest.php, line 48
Contains \Drupal\help\Tests\HelpEmptyPageTest.

Class

HelpEmptyPageTest
Tests the empty HTML page.

Namespace

Drupal\help\Tests

Code

public function testEmptyHookHelp() {
  $all_modules = system_rebuild_module_data();
  $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;
  });
  \Drupal::service('module_installer')
    ->install(array_keys($all_modules));
  $route = \Drupal::service('router.route_provider')
    ->getRouteByName('<front>');
  \Drupal::service('module_handler')
    ->invokeAll('help', [
    '<front>',
    new RouteMatch('<front>', $route),
  ]);
}