HelpEmptyPageTest.php in Drupal 10
File
core/modules/help/tests/src/Kernel/HelpEmptyPageTest.php
View source
<?php
namespace Drupal\Tests\help\Kernel;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Routing\RouteMatch;
use Drupal\help_test\SupernovaGenerator;
use Drupal\KernelTests\KernelTestBase;
class HelpEmptyPageTest extends KernelTestBase {
protected static $modules = [
'system',
'help_test',
'user',
'path_alias',
];
public function register(ContainerBuilder $container) {
parent::register($container);
$container
->set('url_generator', new SupernovaGenerator());
}
public function testEmptyHookHelp() {
$all_modules = \Drupal::service('extension.list.module')
->getList();
$all_modules = array_filter($all_modules, function ($module) {
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),
]);
}
}