ModuleHandlerTest.php in Drupal 10
File
core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Extension;
use Drupal\Core\Extension\Exception\UnknownExtensionException;
use Drupal\KernelTests\KernelTestBase;
class ModuleHandlerTest extends KernelTestBase {
public function testInvalidGetName() {
$this
->expectException(UnknownExtensionException::class);
$this
->expectExceptionMessage('The module module_nonsense does not exist.');
$module_handler = $this->container
->get('module_handler');
$module_handler
->getName('module_nonsense');
}
}