You are here

public function LanguageContentSettingsTest::testLanguageContent in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc6/LanguageContentSettingsTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\LanguageContentSettingsTest::testLanguageContent()
  2. 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc6/LanguageContentSettingsTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\LanguageContentSettingsTest::testLanguageContent()

Tests migration of content language settings.

File

modules/ubercart/tests/src/Kernel/Migrate/uc6/LanguageContentSettingsTest.php, line 52

Class

LanguageContentSettingsTest
Tests migration of language content setting variables for node and products.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6

Code

public function testLanguageContent() {

  // Assert that translatable products are still translatable.
  $config = $this
    ->config('language.content_settings.commerce_product.product');
  $this
    ->assertSame($config
    ->get('target_entity_type_id'), 'commerce_product');
  $this
    ->assertSame($config
    ->get('target_bundle'), 'product');
  $this
    ->assertSame($config
    ->get('default_langcode'), 'current_interface');
  $this
    ->assertTrue($config
    ->get('third_party_settings.content_translation.enabled'));
  $config = $this
    ->config('language.content_settings.commerce_product.product_kit');
  $this
    ->assertSame($config
    ->get('target_entity_type_id'), 'commerce_product');
  $this
    ->assertSame($config
    ->get('target_bundle'), 'product_kit');
  $this
    ->assertSame($config
    ->get('default_langcode'), 'current_interface');
  $this
    ->assertTrue($config
    ->get('third_party_settings.content_translation.enabled'));

  // Assert that non translatable nodes and products are not translatable.
  $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page');
  $this
    ->assertTrue($config
    ->isDefaultConfiguration());
  $this
    ->assertFalse($config
    ->isLanguageAlterable());
  $this
    ->assertSame($config
    ->getDefaultLangcode(), 'site_default');
  $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'story');
  $this
    ->assertTrue($config
    ->isDefaultConfiguration());
  $this
    ->assertFalse($config
    ->isLanguageAlterable());
  $this
    ->assertSame($config
    ->getDefaultLangcode(), 'site_default');
  $config = ContentLanguageSettings::loadByEntityTypeBundle('commerce_product', 'ship');
  $this
    ->assertTrue($config
    ->isDefaultConfiguration());
  $this
    ->assertFalse($config
    ->isLanguageAlterable());
  $this
    ->assertSame($config
    ->getDefaultLangcode(), 'site_default');
  $config = ContentLanguageSettings::loadByEntityTypeBundle('commerce_product', 'default');
  $this
    ->assertTrue($config
    ->isDefaultConfiguration());
  $this
    ->assertFalse($config
    ->isLanguageAlterable());
  $this
    ->assertSame($config
    ->getDefaultLangcode(), 'site_default');
}