function DependencyTest::testEnableWithoutDependency

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableWithoutDependency()
  2. 8.9.x core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableWithoutDependency()
  3. 11.x core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableWithoutDependency()

Attempts to enable the Content Translation module without Language enabled.

File

core/modules/system/tests/src/Functional/Module/DependencyTest.php, line 44

Class

DependencyTest
Enable module without dependency enabled.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testEnableWithoutDependency() : void {
    // Attempt to enable Content Translation without Language enabled.
    $edit = [];
    $edit['modules[content_translation][enable]'] = 'content_translation';
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertSession()
        ->pageTextContains('Some required modules must be installed');
    $this->assertModules([
        'content_translation',
        'language',
    ], FALSE);
    // Assert that the language module config was not installed.
    $this->assertNoModuleConfig('language');
    $this->submitForm([], 'Continue');
    $this->assertSession()
        ->pageTextContains('2 modules have been installed: Content Translation, Language.');
    $this->assertModules([
        'content_translation',
        'language',
    ], TRUE);
    // Assert that the language YAML files were created.
    $storage = $this->container
        ->get('config.storage');
    $this->assertNotEmpty($storage->listAll('language.entity.'), 'Language config entity files exist.');
}

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