public function AdvancedHelpHintTest::testHookHelp in Freelinking 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Kernel/AdvancedHelpHintTest.php \Drupal\Tests\freelinking\Kernel\AdvancedHelpHintTest::testHookHelp()
Asserts hook_help() is functional.
@dataProvider hookHelpProvider
Parameters
array $modules: An array of optional module dependencies.
Throws
\Exception
File
- tests/
src/ Kernel/ AdvancedHelpHintTest.php, line 34
Class
- AdvancedHelpHintTest
- Tests hook_help implementation.
Namespace
Drupal\Tests\freelinking\KernelCode
public function testHookHelp(array $modules = []) {
$routeMatchProphet = $this
->prophesize('\\Drupal\\Core\\Routing\\RouteMatchInterface');
$routeMatch = $routeMatchProphet
->reveal();
if (!empty($modules)) {
$module_handler = $this->container
->get('module_handler');
$discovery = new ExtensionDiscovery($this->root);
$discovery
->setProfileDirectories([]);
$list = $discovery
->scan('module');
foreach ($modules as $name) {
if (!isset($list[$name])) {
throw new \Exception("Unavailable module: '{$name}'. If this module needs to be downloaded separately, annotate the test class with '@requires module {$name}'.");
}
$extension = $list[$name];
$module_handler
->addModule($name, $extension
->getPath());
$module_handler
->load($name);
}
}
$help = freelinking_help('help.page.freelinking', $routeMatch);
$this
->assertNotEmpty($help);
}