You are here

public function DependencyTest::testEnableWithoutDependency in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testEnableWithoutDependency()
  2. 9 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 41

Class

DependencyTest
Enable module without dependency enabled.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testEnableWithoutDependency() {

  // 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 enabled');
  $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 enabled: 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.');
}