class LanguageListModuleInstallTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php \Drupal\Tests\language\Functional\LanguageListModuleInstallTest
- 9 core/modules/language/tests/src/Functional/LanguageListModuleInstallTest.php \Drupal\Tests\language\Functional\LanguageListModuleInstallTest
Tests enabling Language if a module exists that calls LanguageManager::getLanguages() during installation.
@group language
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\language\Functional\LanguageListModuleInstallTest
Expanded class hierarchy of LanguageListModuleInstallTest
File
- core/
modules/ language/ tests/ src/ Functional/ LanguageListModuleInstallTest.php, line 13
Namespace
Drupal\Tests\language\FunctionalView source
class LanguageListModuleInstallTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'language_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests enabling Language.
*/
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
->drupalGet('admin/modules');
$this
->submitForm($edit, 'Install');
$this
->assertEquals(1, \Drupal::state()
->get('language_test.language_count_preinstall', 0), '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');
}
}