public function CoffeeCommandsTest::testHookCoffeeCommands in Coffee 8
Tests hook_coffee_commands().
File
- tests/
src/ Kernel/ CoffeeCommandsTest.php, line 62
Class
- CoffeeCommandsTest
- Tests hook_coffee_commands().
Namespace
Drupal\Tests\coffee\KernelCode
public function testHookCoffeeCommands() {
$expected_hook = [
'value' => Url::fromRoute('<front>')
->toString(),
'label' => t('Coffee hook fired!'),
'command' => ':test',
];
$expected_system = [
'value' => Url::fromRoute('<front>')
->toString(),
'label' => t('Go to front page'),
'command' => ':front',
];
$expected_node = [
'value' => Url::fromRoute('node.add', [
'node_type' => 'page',
])
->toString(),
'label' => 'Basic page',
'command' => ':add Basic page',
];
$commands = \Drupal::moduleHandler()
->invokeAll('coffee_commands');
$this
->assertContains($expected_hook, $commands);
$this
->assertContains($expected_system, $commands);
$this
->assertContains($expected_node, $commands);
}