annotate core/modules/system/src/Tests/Installer/InstallerLanguageDirectionTest.php @ 12:7a779792577d

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