546ab25e03414209ef5b3d73146042994bebe77c
[yaffs-website] / web / core / modules / language / tests / src / Kernel / Migrate / d6 / MigrateLanguageContentSettingsTest.php
1 <?php
2
3 namespace Drupal\Tests\language\Kernel\Migrate\d6;
4
5 use Drupal\language\Entity\ContentLanguageSettings;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Tests migration of language content setting variables,
10  * language_content_type_$type, i18n_node_options_* and i18n_lock_node_*.
11  *
12  * @group migrate_drupal_6
13  */
14 class MigrateLanguageContentSettingsTest extends MigrateDrupal6TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['node', 'text', 'language', 'content_translation', 'menu_ui'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp() {
25     parent::setUp();
26
27     $this->installConfig(['node']);
28     $this->executeMigrations(['d6_node_type', 'd6_language_content_settings']);
29   }
30
31   /**
32    * Tests migration of content language settings.
33    */
34   public function testLanguageContent() {
35     // Assert that a translatable content is still translatable.
36     $config = $this->config('language.content_settings.node.article');
37     $this->assertSame($config->get('target_entity_type_id'), 'node');
38     $this->assertSame($config->get('target_bundle'), 'article');
39     $this->assertSame($config->get('default_langcode'), 'current_interface');
40     $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
41
42     // Assert that a non-translatable content is not translatable.
43     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'company');
44     $this->assertTrue($config->isDefaultConfiguration());
45     $this->assertFalse($config->isLanguageAlterable());
46     $this->assertSame($config->getDefaultLangcode(), 'site_default');
47   }
48
49   /**
50    * Tests migration of content language settings when there is no language lock.
51    */
52   public function testLanguageContentWithNoLanguageLock() {
53     // Assert that a we can assign a language.
54     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'employee');
55     $this->assertSame($config->getDefaultLangcode(), 'current_interface');
56     $this->assertTrue($config->isLanguageAlterable());
57   }
58
59 }