annotate core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php @ 19:fa3358dc1485 tip

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