function ModuleInstallerTest::testUninstallValidatorsBC

Tests the BC layer for uninstall validators.

@covers ::__construct @covers ::addUninstallValidator

@group legacy

File

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

Class

ModuleInstallerTest
Tests the ModuleInstaller class.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testUninstallValidatorsBC() : void {
    $this->expectDeprecation('The "module_installer.uninstall_validators" service is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Inject "!tagged_iterator module_install.uninstall_validator" instead. See https://www.drupal.org/node/3432595');
    $module_installer = new ModuleInstaller($this->container
        ->getParameter('app.root'), $this->container
        ->get('module_handler'), $this->container
        ->get('kernel'), $this->container
        ->get('database'), $this->container
        ->get('update.update_hook_registry'), $this->container
        ->get('logger.channel.default'));
    $this->expectDeprecation('Drupal\\Core\\Extension\\ModuleInstaller::addUninstallValidator is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Inject the uninstall validators into the constructor instead. See https://www.drupal.org/node/3432595');
    $module_installer->addUninstallValidator($this->createMock(ModuleUninstallValidatorInterface::class));
}

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