InstallerLanguageDirectionTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. /**
  4. * Verifies that the early installer uses the correct language direction.
  5. *
  6. * @group Installer
  7. */
  8. class InstallerLanguageDirectionTest extends InstallerTestBase {
  9. /**
  10. * Overrides the language code the installer should use.
  11. *
  12. * @var string
  13. */
  14. protected $langcode = 'ar';
  15. /**
  16. * {@inheritdoc}
  17. */
  18. protected function setUpLanguage() {
  19. // Place a custom local translation in the translations directory.
  20. mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
  21. file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.ar.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Arabic\"");
  22. parent::setUpLanguage();
  23. // After selecting a different language than English, all following screens
  24. // should be translated already.
  25. $elements = $this->xpath('//input[@type="submit"]/@value');
  26. $this->assertEqual(current($elements)->getText(), 'Save and continue Arabic');
  27. $this->translations['Save and continue'] = 'Save and continue Arabic';
  28. // Verify that language direction is right-to-left.
  29. $direction = current($this->xpath('/@dir'))->getText();
  30. $this->assertEqual($direction, 'rtl');
  31. }
  32. /**
  33. * Confirms that the installation succeeded.
  34. */
  35. public function testInstalled() {
  36. $this->assertUrl('user/1');
  37. $this->assertResponse(200);
  38. }
  39. }