Chris@16: root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); Chris@17: file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); Chris@16: Chris@16: parent::setUpLanguage(); Chris@16: Chris@16: // After selecting a different language than English, all following screens Chris@16: // should be translated already. Chris@16: $elements = $this->xpath('//input[@type="submit"]/@value'); Chris@16: $this->assertEqual(current($elements)->getText(), 'Save and continue de'); Chris@16: $this->translations['Save and continue'] = 'Save and continue de'; Chris@16: Chris@16: // Check the language direction. Chris@16: $direction = current($this->xpath('/@dir'))->getText(); Chris@16: $this->assertEqual($direction, 'ltr'); Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpSettings() { Chris@16: // We are creating a table here to force an error in the installer because Chris@16: // it will try and create the drupal_install_test table as this is part of Chris@16: // the standard database tests performed by the installer in Chris@16: // Drupal\Core\Database\Install\Tasks. Chris@17: Database::getConnection('default')->query('CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)'); Chris@16: parent::setUpSettings(); Chris@16: Chris@16: // Ensure that the error message translation is working. Chris@18: $this->assertRaw('Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der Installationshandbuch, oder kontaktieren Sie Ihren Hosting-Anbieter.'); Chris@17: $this->assertRaw('CREATE ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY) fehlgeschlagen.'); Chris@16: Chris@16: // Now do it successfully. Chris@16: Database::getConnection('default')->query('DROP TABLE {drupal_install_test}'); Chris@16: parent::setUpSettings(); Chris@16: } Chris@16: Chris@16: /** Chris@16: * Verifies the expected behaviors of the installation result. Chris@16: */ Chris@16: public function testInstaller() { Chris@16: $this->assertUrl('user/1'); Chris@16: $this->assertResponse(200); Chris@16: Chris@16: // Verify German was configured but not English. Chris@16: $this->drupalGet('admin/config/regional/language'); Chris@16: $this->assertText('German'); Chris@16: $this->assertNoText('English'); Chris@16: Chris@16: // The current container still has the english as current language, rebuild. Chris@16: $this->rebuildContainer(); Chris@16: /** @var \Drupal\user\Entity\User $account */ Chris@16: $account = User::load(0); Chris@16: $this->assertEqual($account->language()->getId(), 'en', 'Anonymous user is English.'); Chris@16: $account = User::load(1); Chris@16: $this->assertEqual($account->language()->getId(), 'en', 'Administrator user is English.'); Chris@16: $account = $this->drupalCreateUser(); Chris@16: $this->assertEqual($account->language()->getId(), 'de', 'New user is German.'); Chris@16: Chris@16: // Ensure that we can enable basic_auth on a non-english site. Chris@16: $this->drupalPostForm('admin/modules', ['modules[basic_auth][enable]' => TRUE], t('Install')); Chris@16: $this->assertResponse(200); Chris@16: Chris@16: // Assert that the theme CSS was added to the page. Chris@16: $edit = ['preprocess_css' => FALSE]; Chris@16: $this->drupalPostForm('admin/config/development/performance', $edit, t('Save configuration')); Chris@16: $this->drupalGet(''); Chris@16: $this->assertRaw('classy/css/components/action-links.css'); Chris@16: Chris@16: // Verify the strings from the translation files were imported. Chris@16: $test_samples = ['Save and continue', 'Anonymous']; Chris@16: foreach ($test_samples as $sample) { Chris@16: $edit = []; Chris@16: $edit['langcode'] = 'de'; Chris@16: $edit['translation'] = 'translated'; Chris@16: $edit['string'] = $sample; Chris@16: $this->drupalPostForm('admin/config/regional/translate', $edit, t('Filter')); Chris@16: $this->assertText($sample . ' de'); Chris@16: } Chris@16: Chris@16: /** @var \Drupal\language\ConfigurableLanguageManager $language_manager */ Chris@16: $language_manager = \Drupal::languageManager(); Chris@16: Chris@16: // Installed in German, configuration should be in German. No German or Chris@16: // English overrides should be present. Chris@16: $config = \Drupal::config('user.settings'); Chris@16: $override_de = $language_manager->getLanguageConfigOverride('de', 'user.settings'); Chris@16: $override_en = $language_manager->getLanguageConfigOverride('en', 'user.settings'); Chris@16: $this->assertEqual($config->get('anonymous'), 'Anonymous de'); Chris@16: $this->assertEqual($config->get('langcode'), 'de'); Chris@16: $this->assertTrue($override_de->isNew()); Chris@16: $this->assertTrue($override_en->isNew()); Chris@16: Chris@16: // Assert that adding English makes the English override available. Chris@16: $edit = ['predefined_langcode' => 'en']; Chris@16: $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); Chris@16: $override_en = $language_manager->getLanguageConfigOverride('en', 'user.settings'); Chris@16: $this->assertFalse($override_en->isNew()); Chris@16: $this->assertEqual($override_en->get('anonymous'), 'Anonymous'); Chris@16: } Chris@16: Chris@16: /** Chris@16: * Returns the string for the test .po file. Chris@16: * Chris@16: * @param string $langcode Chris@16: * The language code. Chris@16: * @return string Chris@16: * Contents for the test .po file. Chris@16: */ Chris@16: protected function getPo($langcode) { Chris@16: return <<installation handbook, or contact your hosting provider." Chris@18: msgstr "Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der Installationshandbuch, oder kontaktieren Sie Ihren Hosting-Anbieter." Chris@16: Chris@16: msgid "Failed to CREATE a test table on your database server with the command %query. The server reports the following message: %error.

Are you sure the configured username has the necessary permissions to create tables in the database?

" Chris@16: msgstr "CREATE ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl %query fehlgeschlagen." Chris@16: ENDPO; Chris@16: } Chris@16: Chris@16: }