function JsonApiFunctionalMultilingualTest::setUp

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::setUp()
  2. 10 core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::setUp()
  3. 11.x core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php \Drupal\Tests\jsonapi\Functional\JsonApiFunctionalMultilingualTest::setUp()

Overrides JsonApiFunctionalTestBase::setUp

File

core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalMultilingualTest.php, line 39

Class

JsonApiFunctionalMultilingualTest
Tests JSON:API multilingual support.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $language = ConfigurableLanguage::createFromLangcode('ca');
    $language->save();
    ConfigurableLanguage::createFromLangcode('ca-fr')->save();
    // In order to reflect the changes for a multilingual site in the container
    // we have to rebuild it.
    $this->rebuildContainer();
    \Drupal::configFactory()->getEditable('language.negotiation')
        ->set('url.prefixes.ca', 'ca')
        ->set('url.prefixes.ca-fr', 'ca-fr')
        ->save();
    ContentLanguageSettings::create([
        'target_entity_type_id' => 'node',
        'target_bundle' => 'article',
    ])->setThirdPartySetting('content_translation', 'enabled', TRUE)
        ->save();
    $this->createDefaultContent(5, 5, TRUE, TRUE, static::IS_MULTILINGUAL, FALSE);
}

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