function ModuleInstallerTest::testInvalidCoreInstall

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testInvalidCoreInstall()
  2. 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testInvalidCoreInstall()
  3. 11.x 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 95

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);
}

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