function ConfigInstallWebTest::testUnmetDependenciesInstall

Same name in other branches
  1. 8.9.x core/modules/config/tests/src/Functional/ConfigInstallWebTest.php \Drupal\Tests\config\Functional\ConfigInstallWebTest::testUnmetDependenciesInstall()
  2. 10 core/modules/config/tests/src/Functional/ConfigInstallWebTest.php \Drupal\Tests\config\Functional\ConfigInstallWebTest::testUnmetDependenciesInstall()
  3. 11.x core/modules/config/tests/src/Functional/ConfigInstallWebTest.php \Drupal\Tests\config\Functional\ConfigInstallWebTest::testUnmetDependenciesInstall()

Tests unmet dependencies detection.

File

core/modules/config/tests/src/Functional/ConfigInstallWebTest.php, line 199

Class

ConfigInstallWebTest
Tests configuration objects before and after module install and uninstall.

Namespace

Drupal\Tests\config\Functional

Code

public function testUnmetDependenciesInstall() {
    $this->drupalLogin($this->adminUser);
    // We need to install separately since config_install_dependency_test does
    // not depend on config_test and order is important.
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_test][enable]' => TRUE,
    ], 'Install');
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_install_dependency_test][enable]' => TRUE,
    ], 'Install');
    $this->assertSession()
        ->responseContains('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)</em>');
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_test_language][enable]' => TRUE,
    ], 'Install');
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_install_dependency_test][enable]' => TRUE,
    ], 'Install');
    $this->assertSession()
        ->responseContains('Unable to install <em class="placeholder">Config install dependency test</em> due to unmet dependencies: <em class="placeholder">config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)</em>');
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_other_module_config_test][enable]' => TRUE,
    ], 'Install');
    $this->drupalGet('admin/modules');
    $this->submitForm([
        'modules[config_install_dependency_test][enable]' => TRUE,
    ], 'Install');
    $this->rebuildContainer();
    $this->assertInstanceOf(ConfigTest::class, \Drupal::entityTypeManager()->getStorage('config_test')
        ->load('other_module_test_with_dependency'));
}

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