You are here

protected function InstallerTranslationTest::setUpLanguage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Installer/InstallerTranslationTest.php \Drupal\system\Tests\Installer\InstallerTranslationTest::setUpLanguage()

Installer step: Select language.

Overrides InstallerTestBase::setUpLanguage

File

core/modules/system/src/Tests/Installer/InstallerTranslationTest.php, line 31
Contains \Drupal\system\Tests\Installer\InstallerTranslationTest.

Class

InstallerTranslationTest
Installs Drupal in German and checks resulting site.

Namespace

Drupal\system\Tests\Installer

Code

protected function setUpLanguage() {

  // Place a custom local translation in the translations directory.
  mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
  file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this
    ->getPo('de'));
  parent::setUpLanguage();

  // After selecting a different language than English, all following screens
  // should be translated already.
  $elements = $this
    ->xpath('//input[@type="submit"]/@value');
  $this
    ->assertEqual((string) current($elements), 'Save and continue de');
  $this->translations['Save and continue'] = 'Save and continue de';

  // Check the language direction.
  $direction = (string) current($this
    ->xpath('/html/@dir'));
  $this
    ->assertEqual($direction, 'ltr');
}