3 namespace Drupal\FunctionalTests\Installer;
6 * Installs Drupal in German and checks resulting site.
10 * @see \Drupal\FunctionalTests\Installer\InstallerTranslationTest
12 class InstallerTranslationQueryTest extends InstallerTestBase {
15 * Overrides the language code in which to install Drupal.
19 protected $langcode = 'de';
24 protected function visitInstaller() {
25 // Place a custom local translation in the translations directory.
26 mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
27 file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de'));
29 // The unrouted URL assembler does not exist at this point, so we build the
31 $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?langcode=' . $this->langcode);
33 // The language should have been automatically detected, all following
34 // screens should be translated already.
35 $elements = $this->xpath('//input[@type="submit"]/@value');
36 $this->assertEqual(current($elements)->getText(), 'Save and continue de');
37 $this->translations['Save and continue'] = 'Save and continue de';
39 // Check the language direction.
40 $direction = current($this->xpath('/@dir'))->getText();
41 $this->assertEqual($direction, 'ltr');
47 protected function setUpLanguage() {
48 // The language was was preset by passing a query parameter in the URL, so
49 // no explicit language selection is necessary.
53 * Verifies the expected behaviors of the installation result.
55 public function testInstaller() {
56 $this->assertUrl('user/1');
57 $this->assertResponse(200);
59 // Verify German was configured but not English.
60 $this->drupalGet('admin/config/regional/language');
61 $this->assertText('German');
62 $this->assertNoText('English');
66 * Returns the string for the test .po file.
68 * @param string $langcode
71 * Contents for the test .po file.
73 protected function getPo($langcode) {
78 msgid "Save and continue"
79 msgstr "Save and continue $langcode"