comparison core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
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(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
25 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\"");
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 }