57439d588d1bb6f31ac87123ae71af98cd90e3d3
[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->installEntitySchema('node');
29     $this->executeMigrations(['d6_node_type', 'd6_language_content_settings']);
30   }
31
32   /**
33    * Tests migration of content language settings.
34    */
35   public function testLanguageContent() {
36     // Assert that a translatable content is still translatable.
37     $config = $this->config('language.content_settings.node.article');
38     $this->assertSame($config->get('target_entity_type_id'), 'node');
39     $this->assertSame($config->get('target_bundle'), 'article');
40     $this->assertSame($config->get('default_langcode'), 'current_interface');
41     $this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
42
43     // Assert that a non-translatable content is not translatable.
44     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'company');
45     $this->assertTrue($config->isDefaultConfiguration());
46     $this->assertFalse($config->isLanguageAlterable());
47     $this->assertSame($config->getDefaultLangcode(), 'site_default');
48   }
49
50   /**
51    * Tests migration of content language settings when there is no language lock.
52    */
53   public function testLanguageContentWithNoLanguageLock() {
54     // Assert that a we can assign a language.
55     $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'employee');
56     $this->assertSame($config->getDefaultLangcode(), 'current_interface');
57     $this->assertTrue($config->isLanguageAlterable());
58   }
59
60 }