You are here

public function ConfigInstallWebTest::testUnmetDependenciesInstall in Drupal 8

Same name and namespace in other branches
  1. 9 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 190

Class

ConfigInstallWebTest
Tests installation and removal of configuration objects in install, disable and uninstall functionality.

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
    ->drupalPostForm('admin/modules', [
    'modules[config_test][enable]' => TRUE,
  ], t('Install'));
  $this
    ->drupalPostForm('admin/modules', [
    'modules[config_install_dependency_test][enable]' => TRUE,
  ], t('Install'));
  $this
    ->assertRaw('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
    ->drupalPostForm('admin/modules', [
    'modules[config_test_language][enable]' => TRUE,
  ], t('Install'));
  $this
    ->drupalPostForm('admin/modules', [
    'modules[config_install_dependency_test][enable]' => TRUE,
  ], t('Install'));
  $this
    ->assertRaw('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
    ->drupalPostForm('admin/modules', [
    'modules[config_other_module_config_test][enable]' => TRUE,
  ], t('Install'));
  $this
    ->drupalPostForm('admin/modules', [
    'modules[config_install_dependency_test][enable]' => TRUE,
  ], t('Install'));
  $this
    ->rebuildContainer();
  $this
    ->assertInstanceOf(ConfigTest::class, \Drupal::entityTypeManager()
    ->getStorage('config_test')
    ->load('other_module_test_with_dependency'));
}