function NodeTypeTranslationTest::installParameters

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php \Drupal\Tests\node\Functional\NodeTypeTranslationTest::installParameters()
  2. 10 core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php \Drupal\Tests\node\Functional\NodeTypeTranslationTest::installParameters()
  3. 11.x core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php \Drupal\Tests\node\Functional\NodeTypeTranslationTest::installParameters()

Install Drupal in a language other than English for this test. This is not needed to test the node type translation itself but acts as a regression test.

Overrides FunctionalTestSetupTrait::installParameters

See also

https://www.drupal.org/node/2584603

File

core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php, line 87

Class

NodeTypeTranslationTest
Ensures that node types translation work correctly.

Namespace

Drupal\Tests\node\Functional

Code

protected function installParameters() {
    $parameters = parent::installParameters();
    $parameters['parameters']['langcode'] = $this->defaultLangcode;
    // Create an empty po file so we don't attempt to download one from
    // localize.drupal.org. It does not need to match the version exactly as the
    // multi-lingual system will fallback.
    \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
    file_put_contents($this->publicFilesDirectory . "/translations/drupal-8.0.0.{$this->defaultLangcode}.po", '');
    return $parameters;
}

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