class InstallerNonEnglishProfileWithoutLocaleModuleTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php \Drupal\FunctionalTests\Installer\InstallerNonEnglishProfileWithoutLocaleModuleTest
Tests installing a profile with non-English language and no locale module.
@group Installer
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait implements \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalTests\Installer\InstallerNonEnglishProfileWithoutLocaleModuleTest implements \Drupal\FunctionalTests\Installer\InstallerTestBase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of InstallerNonEnglishProfileWithoutLocaleModuleTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerNonEnglishProfileWithoutLocaleModuleTest.php, line 12
Namespace
Drupal\FunctionalTests\InstallerView source
class InstallerNonEnglishProfileWithoutLocaleModuleTest extends InstallerTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The testing profile name.
*
* @var string
*/
const PROFILE = 'testing_with_language_without_locale';
/**
* {@inheritdoc}
*/
protected $profile = self::PROFILE;
/**
* {@inheritdoc}
*/
protected function prepareEnvironment() {
parent::prepareEnvironment();
// Create a self::PROFILE testing profile that depends on the 'language'
// module but not on 'locale' module. We set core_version_requirement to '*'
// for the test so that it does not need to be updated between major
// versions.
$profile_info = [
'type' => 'profile',
'core_version_requirement' => '*',
'name' => 'Test with language but without locale',
'install' => [
'language',
],
];
// File API functions are not available yet.
$profile_dir = "{$this->root}/{$this->siteDirectory}/profiles/" . self::PROFILE;
$profile_config_dir = "{$profile_dir}/config/install";
mkdir($profile_config_dir, 0777, TRUE);
$profile_info_file = $profile_dir . '/' . static::PROFILE . '.info.yml';
file_put_contents($profile_info_file, Yaml::encode($profile_info));
// Copy a non-English language config YAML to be installed with the profile.
copy($this->root . '/core/profiles/testing_multilingual/config/install/language.entity.de.yml', $profile_config_dir . '/language.entity.de.yml');
}
/**
* Tests installing a profile with non-English language and no locale module.
*/
public function testNonEnglishProfileWithoutLocaleModule() {
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->addressEquals('user/1');
// Confirm that we are logged-in after installation.
$this->assertSession()
->pageTextContains($this->rootUser
->getAccountName());
// Verify that the confirmation message appears.
require_once $this->root . '/core/includes/install.inc';
$this->assertSession()
->pageTextContains('Congratulations, you installed Drupal!');
$this->assertFalse(\Drupal::service('module_handler')->moduleExists('locale'), 'The Locale module is not installed.');
$this->assertTrue(\Drupal::service('module_handler')->moduleExists('language'), 'The Language module is installed.');
$this->assertTrue(\Drupal::languageManager()->isMultilingual(), 'The language manager is multi-lingual.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.