function LanguageListModuleInstallTest::testModuleInstallLanguageList

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php \Drupal\Tests\language\Functional\LanguageListModuleInstallTest::testModuleInstallLanguageList()
  2. 10 core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php \Drupal\Tests\language\Functional\LanguageListModuleInstallTest::testModuleInstallLanguageList()
  3. 11.x core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php \Drupal\Tests\language\Functional\LanguageListModuleInstallTest::testModuleInstallLanguageList()

Tests enabling Language.

File

core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php, line 30

Class

LanguageListModuleInstallTest
Tests enabling Language if a module exists that calls LanguageManager::getLanguages() during installation.

Namespace

Drupal\Tests\language\Functional

Code

public function testModuleInstallLanguageList() {
    // Since LanguageManager::getLanguages() uses static caches we need to do
    // this by enabling the module using the UI.
    $admin_user = $this->drupalCreateUser([
        'access administration pages',
        'administer modules',
    ]);
    $this->drupalLogin($admin_user);
    $edit = [];
    $edit['modules[language][enable]'] = 'language';
    $this->drupalPostForm('admin/modules', $edit, t('Install'));
    $this->assertEqual(\Drupal::state()->get('language_test.language_count_preinstall', 0), 1, 'Using LanguageManager::getLanguages() returns 1 language during Language installation.');
    // Get updated module list by rebuilding container.
    $this->rebuildContainer();
    $this->assertTrue(\Drupal::moduleHandler()->moduleExists('language'), 'Language module is enabled');
}

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