You are here

public function ModuleInstallerTest::testInvalidCoreInstall in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testInvalidCoreInstall()
  2. 9 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testInvalidCoreInstall()

Tests install with a module with an invalid core version constraint.

@dataProvider providerTestInvalidCoreInstall @covers ::install

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php, line 96

Class

ModuleInstallerTest
Tests the ModuleInstaller class.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testInvalidCoreInstall($module_name, $install_dependencies) {
  $this
    ->expectException(MissingDependencyException::class);
  $this
    ->expectExceptionMessage("Unable to install modules: module '{$module_name}' is incompatible with this version of Drupal core.");
  $this->container
    ->get('module_installer')
    ->install([
    $module_name,
  ], $install_dependencies);
}