diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php index e7b8e9c..9d607b0 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -17,14 +17,35 @@ class InstallerTranslationMultipleLanguageTest extends InstallerTestBase { /** - * Overrides the language code in which to install Drupal. - * - * @var string + * Add a setting to instruct the testing profile to add languages. */ - protected $langcode = 'de'; + protected function setUpTestingLanguages() { + // Need to add both Spanish and German configurable language explicitly + // because the installer language is English. + $this->settings = array( + 'testing_add_languages' => array( + 0 => (object) array( + 'value' => 'es', + 'required' => TRUE, + ), + 1 => (object) array( + 'value' => 'de', + 'required' => TRUE, + ), + ), + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + $this->setUpTestingLanguages(); + parent::setUp(); + } /** - * Overrides InstallerTest::setUpLanguage(). + * {@inheritdoc} */ protected function setUpLanguage() { // Place custom local translations in the translations directory. @@ -33,17 +54,34 @@ protected function setUpLanguage() { file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.es.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Spanish\""); parent::setUpLanguage(); - $this->translations['Save and continue'] = 'Save and continue German'; } /** * Tests that translations for each language were loaded. */ public function testTranslationsLoaded() { - // Verify de and es languages were created. + // Verify German and Spanish were configured. + $this->drupalGet('admin/config/regional/language'); + $this->assertText('German'); + $this->assertText('Spanish'); + // If the installer was English, we expect that configured also. + if ($this->langcode == 'en') { + $this->assertText('English'); + } // Verify the strings from the translation files were imported. - + $edit = array(); + $edit['langcode'] = 'de'; + $edit['translation'] = 'translated'; + $edit['string'] = 'Save and continue'; + $this->drupalPostForm('admin/config/regional/translate', $edit, t('Filter')); + $this->assertText('Save and continue German'); + $edit = array(); + $edit['langcode'] = 'es'; + $edit['translation'] = 'translated'; + $edit['string'] = 'Save and continue'; + $this->drupalPostForm('admin/config/regional/translate', $edit, t('Filter')); + $this->assertText('Save and continue Spanish'); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php new file mode 100644 index 0000000..e4ada83 --- /dev/null +++ b/core/modules/system/src/Tests/Installer/InstallerTranslationMultipleLanguageForeignTest.php @@ -0,0 +1,50 @@ +settings = array( + 'testing_add_languages' => array( + 0 => (object) array( + 'value' => 'es', + 'required' => TRUE, + ), + ), + ); + } + + /** + * {@inheritdoc} + */ + protected function setUpLanguage() { + parent::setUpLanguage(); + $this->translations['Save and continue'] = 'Save and continue German'; + } + +} diff --git a/core/profiles/testing/testing.install b/core/profiles/testing/testing.install new file mode 100644 index 0000000..ef2b5ed --- /dev/null +++ b/core/profiles/testing/testing.install @@ -0,0 +1,23 @@ +save(); + } + } +}