function ModuleHandlerTest::testInvalidGetName

Tests requesting the name of an invalid module.

@legacy-covers ::getName

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php, line 29

Class

ModuleHandlerTest
Tests Drupal\Core\Extension\ModuleHandler.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testInvalidGetName() : void {
  $this->expectException(UnknownExtensionException::class);
  $this->expectExceptionMessage('The module module_nonsense does not exist.');
  $module_handler = $this->container
    ->get('module_handler');
  $module_handler->getModule('module_nonsense');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.