3 namespace Drupal\system\Tests\Installer;
5 use Drupal\simpletest\InstallerTestBase;
8 * Installs Drupal in German and checks resulting site.
12 * @see \Drupal\system\Tests\Installer\InstallerTranslationTest
14 class InstallerTranslationQueryTest extends InstallerTestBase {
17 * Overrides the language code in which to install Drupal.
21 protected $langcode = 'de';
26 protected function visitInstaller() {
27 // Place a custom local translation in the translations directory.
28 mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
29 file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de'));
31 // The unrouted URL assembler does not exist at this point, so we build the
33 $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?langcode=' . $this->langcode);
35 // The language should have been automatically detected, all following
36 // screens should be translated already.
37 $elements = $this->xpath('//input[@type="submit"]/@value');
38 $this->assertEqual((string) current($elements), 'Save and continue de');
39 $this->translations['Save and continue'] = 'Save and continue de';
41 // Check the language direction.
42 $direction = (string) current($this->xpath('/html/@dir'));
43 $this->assertEqual($direction, 'ltr');
49 protected function setUpLanguage() {
50 // The language was was preset by passing a query parameter in the URL, so
51 // no explicit language selection is necessary.
55 * Verifies the expected behaviors of the installation result.
57 public function testInstaller() {
58 $this->assertUrl('user/1');
59 $this->assertResponse(200);
61 // Verify German was configured but not English.
62 $this->drupalGet('admin/config/regional/language');
63 $this->assertText('German');
64 $this->assertNoText('English');
68 * Returns the string for the test .po file.
70 * @param string $langcode
73 * Contents for the test .po file.
75 protected function getPo($langcode) {
80 msgid "Save and continue"
81 msgstr "Save and continue $langcode"