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