function MigrateLanguageContentSettingsTest::testLanguageContent

Same name in this branch
  1. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentSettingsTest::testLanguageContent()
Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentSettingsTest::testLanguageContent()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageContentSettingsTest::testLanguageContent()
  3. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentSettingsTest::testLanguageContent()
  4. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageContentSettingsTest::testLanguageContent()
  5. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentSettingsTest::testLanguageContent()
  6. 11.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageContentSettingsTest::testLanguageContent()

Tests migration of content language settings.

File

core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageContentSettingsTest.php, line 47

Class

MigrateLanguageContentSettingsTest
Tests the migration of language-related settings.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

public function testLanguageContent() : void {
    // Assert that a translatable content is still translatable.
    $config = $this->config('language.content_settings.node.blog');
    $this->assertSame($config->get('target_entity_type_id'), 'node');
    $this->assertSame($config->get('target_bundle'), 'blog');
    $this->assertSame($config->get('default_langcode'), 'current_interface');
    $this->assertFalse($config->get('language_alterable'));
    $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
    // Assert that a translatable content is translatable.
    $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page');
    $this->assertFalse($config->isDefaultConfiguration());
    $this->assertTrue($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'current_interface');
    // Assert that a non-translatable content is not translatable.
    $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'forum');
    $this->assertTrue($config->isDefaultConfiguration());
    $this->assertFalse($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'site_default');
    // Make sure there's no migration exceptions.
    $messages = $this->migration
        ->getIdMap()
        ->getMessages()
        ->fetchAll();
    $this->assertEmpty($messages);
    // Assert that a content type translatable with entity_translation is still
    // translatable.
    $config = $this->config('language.content_settings.node.test_content_type');
    $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
    $this->assertSame($config->get('default_langcode'), 'und');
    // Assert that a content type without a 'language_content_type' variable is
    // not translatable
    $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'book');
    $this->assertTrue($config->isDefaultConfiguration());
    $this->assertFalse($config->isLanguageAlterable());
    $this->assertSame($config->getDefaultLangcode(), 'site_default');
}

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