You are here

protected function AddToCartMultilingualTest::setupMultilingual in Commerce Core 8.2

Sets up the multilingual items.

1 call to AddToCartMultilingualTest::setupMultilingual()
AddToCartMultilingualTest::setUp in modules/cart/tests/src/FunctionalJavascript/AddToCartMultilingualTest.php

File

modules/cart/tests/src/FunctionalJavascript/AddToCartMultilingualTest.php, line 148

Class

AddToCartMultilingualTest
Tests the add to cart form for multilingual.

Namespace

Drupal\Tests\commerce_cart\FunctionalJavascript

Code

protected function setupMultilingual() {

  // Add a new language.
  ConfigurableLanguage::createFromLangcode('fr')
    ->save();

  // Enable translation for the product and ensure the change is picked up.
  $this->container
    ->get('content_translation.manager')
    ->setEnabled('commerce_product', $this->variation
    ->bundle(), TRUE);
  $this->container
    ->get('content_translation.manager')
    ->setEnabled('commerce_product_variation', $this->variation
    ->bundle(), TRUE);
  $this->container
    ->get('entity_type.manager')
    ->clearCachedDefinitions();
  $this->container
    ->get('router.builder')
    ->rebuild();

  // Rebuild the container so that the new languages are picked up by services
  // that hold a list of languages.
  $this
    ->rebuildContainer();
}