function DevelHookCommandTest::testErrors

Unknown hooks and implementations are errors.

File

tests/src/Kernel/DevelHookCommandTest.php, line 87

Class

DevelHookCommandTest
Tests the devel:hook command.

Namespace

Drupal\Tests\devel\Kernel

Code

public function testErrors() : void {
  try {
    $this->runCommand([
      'hook' => 'help',
      'implementation' => 'no_such_module',
    ]);
    $this->fail('Expected an exception.');
  } catch (\InvalidArgumentException $e) {
    $this->assertStringContainsString('does not implement hook_help()', $e->getMessage());
  }
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessage('No implementations.');
  $this->runCommand([
    'hook' => 'no_such_hook',
  ]);
}