You are here

public function DependencyTest::testEnableWithoutDependency in Drupal 8

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

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
    ->drupalPostForm('admin/modules', $edit, t('Install'));
  $this
    ->assertText(t('Some required modules must be enabled'), 'Dependency required.');
  $this
    ->assertModules([
    'content_translation',
    'language',
  ], FALSE);

  // Assert that the language tables weren't enabled.
  $this
    ->assertTableCount('language', FALSE);
  $this
    ->drupalPostForm(NULL, NULL, t('Continue'));
  $this
    ->assertText(t('2 modules have been enabled: Content Translation, Language.'), 'Modules status has been updated.');
  $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.');
}