You are here

protected function WebTestBase::writeCustomTranslations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::writeCustomTranslations()

Writes custom translations to the test site's settings.php.

Use TestBase::addCustomTranslations() to queue custom translations before calling this method.

1 call to WebTestBase::writeCustomTranslations()
PageTitleTest::testRoutingTitle in core/modules/system/src/Tests/System/PageTitleTest.php
Tests the page title of render arrays.

File

core/modules/simpletest/src/WebTestBase.php, line 1138
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function writeCustomTranslations() {
  $settings = array();
  foreach ($this->customTranslations as $langcode => $values) {
    $settings_key = 'locale_custom_strings_' . $langcode;

    // Update in-memory settings directly.
    $this
      ->settingsSet($settings_key, $values);
    $settings['settings'][$settings_key] = (object) array(
      'value' => $values,
      'required' => TRUE,
    );
  }

  // Only rewrite settings if there are any translation changes to write.
  if (!empty($settings)) {
    $this
      ->writeSettings($settings);
  }
}