class InstallerTranslationNonStandardFilenamesTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php \Drupal\FunctionalTests\Installer\InstallerTranslationNonStandardFilenamesTest

Tests non-standard named translation files get imported during install.

@group Installer

Hierarchy

Expanded class hierarchy of InstallerTranslationNonStandardFilenamesTest

File

core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php, line 14

Namespace

Drupal\FunctionalTests\Installer
View source
class InstallerTranslationNonStandardFilenamesTest extends InstallerTranslationMultipleLanguageNonInteractiveTest {
  
  /**
   * {@inheritdoc}
   */
  protected function prepareEnvironment() {
    BrowserTestBase::prepareEnvironment();
    // Place custom local translations in the translations directory.
    mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
    file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.de.po', $this->getPo('de'));
    file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.es.po', $this->getPo('es'));
  }
  
  /**
   * {@inheritdoc}
   */
  protected function prepareSettings() {
    parent::prepareSettings();
    $settings['config']['locale.settings']['translation']['default_filename'] = (object) [
      'value' => '%project.%language.po',
      'required' => TRUE,
    ];
    $settings['config']['locale.settings']['translation']['default_server_pattern'] = (object) [
      'value' => 'translations://%project.%language.po',
      'required' => TRUE,
    ];
    $this->writeSettings($settings);
  }

}

Members

Title Sort descending Modifiers Object type Summary
InstallerTranslationNonStandardFilenamesTest::prepareEnvironment protected function Prepares the current environment for running the test.
InstallerTranslationNonStandardFilenamesTest::prepareSettings protected function Prepares site settings and services before installation.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.