You are here

function DependencyTest::testEnableWithoutDependency in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/DependencyTest.php \Drupal\system\Tests\Module\DependencyTest::testEnableWithoutDependency()

Attempts to enable the Content Translation module without Language enabled.

File

core/modules/system/src/Tests/Module/DependencyTest.php, line 36
Contains \Drupal\system\Tests\Module\DependencyTest.

Class

DependencyTest
Enable module without dependency enabled.

Namespace

Drupal\system\Tests\Module

Code

function testEnableWithoutDependency() {

  // Attempt to enable Content Translation without Language enabled.
  $edit = array();
  $edit['modules[Multilingual][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(array(
    '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(array(
    'content_translation',
    'language',
  ), TRUE);

  // Assert that the language YAML files were created.
  $storage = $this->container
    ->get('config.storage');
  $this
    ->assertTrue(count($storage
    ->listAll('language.entity.')) > 0, 'Language config entity files exist.');
}