Commit 3f28dd7c authored by alexpott's avatar alexpott

Issue #2344967 followup by Gábor Hojtsy, Sutharsan: Tests for localization...

Issue #2344967 followup by Gábor Hojtsy, Sutharsan: Tests for localization update does not update configuration translations
parent f01bb094
* @file
* Contains \Drupal\locale\Tests\LocaleConfigTranslationImportTest.
namespace Drupal\locale\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Core\Url;
* Tests translation update's effects on configuration translations.
* @group locale
class LocaleConfigTranslationImportTest extends WebTestBase {
* Modules to enable.
* @var array
public static $modules = array('language', 'update', 'locale_test_translate');
* {@inheritdoc}
protected function setUp() {
$admin_user = $this->drupalCreateUser(array('administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions'));
// Update module should not go out to d.o to check for updates. We override
// the url to an invalid update source. No update data will be found.
\Drupal::config('update.settings')->set('fetch.url', (string) Url::fromRoute('<front>', array(), array('absolute' => TRUE)))->save();
* Test update changes configuration translations if enabled after language.
public function testConfigTranslationImport() {
// Add a language. The Afrikaans translation file of locale_test_translate
// ( has been prepared with a configuration translation.
// Enable locale module.
// Enable import of translations. By default this is disabled for automated
// tests.
->set('translation.import_enabled', TRUE)
// Add translation permissions now that the locale module has been enabled.
$edit = array(
'authenticated[translate interface]' => 'translate interface',
$this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions'));
// Check and update the translation status. This will import the Afrikaans
// translations of locale_test_translate module.
// Override the Drupal core translation status to be up to date.
// Drupal core should not be a subject in this test.
$status = locale_translation_get_status();
$status['drupal']['af']->type = 'current';
\Drupal::state()->set('locale.translation_status', $status);
$this->drupalPostForm('admin/reports/translations', array(), t('Update translations'));
// Check if configuration translations have been imported.
$override = \Drupal::languageManager()->getLanguageConfigOverride('af', 'system.maintenance');
$this->assertEqual($override->get('message'), 'Ons is tans besig met onderhoud op @site. Wees asseblief geduldig, ons sal binnekort weer terug wees.');
msgid ""
msgstr ""
"Project-Id-Version: Drupal 8\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\\n"
msgid "@site is currently under maintenance. We should be back shortly. Thank you for your patience."
msgstr "Ons is tans besig met onderhoud op @site. Wees asseblief geduldig, ons sal binnekort weer terug wees."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment