3 namespace Drupal\system\Tests\Installer;
5 use Drupal\simpletest\InstallerTestBase;
8 * Verifies that the early installer uses the correct language direction.
12 class InstallerLanguageDirectionTest extends InstallerTestBase {
15 * Overrides the language code the installer should use.
19 protected $langcode = 'ar';
24 protected function setUpLanguage() {
25 // Place a custom local translation in the translations directory.
26 mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
27 file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.ar.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Arabic\"");
29 parent::setUpLanguage();
30 // After selecting a different language than English, all following screens
31 // should be translated already.
32 $elements = $this->xpath('//input[@type="submit"]/@value');
33 $this->assertEqual((string) current($elements), 'Save and continue Arabic');
34 $this->translations['Save and continue'] = 'Save and continue Arabic';
36 // Verify that language direction is right-to-left.
37 $direction = (string) current($this->xpath('/html/@dir'));
38 $this->assertEqual($direction, 'rtl');
42 * Confirms that the installation succeeded.
44 public function testInstalled() {
45 $this->assertUrl('user/1');
46 $this->assertResponse(200);