d7a4551d6f3436b264253abe6b5635f443617807
[yaffs-website] / web / core / modules / language / tests / src / Kernel / Migrate / d7 / MigrateLanguageContentSettingsTest.php
1 <?php
2
3 namespace Drupal\Tests\language\Kernel\Migrate\d7;
4
5 use Drupal\language\Entity\ContentLanguageSettings;
6 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
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_7
13  */
14 class MigrateLanguageContentSettingsTest extends MigrateDrupal7TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['node', 'text', 'language', 'content_translation', 'menu_ui'];
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25
26     $this->installConfig(['node']);
27     $this->executeMigrations(['d7_node_type', 'd7_language_content_settings']);
28   }
29
30   /**
31    * Tests migration of content language settings.
32    */
33   public function testLanguageContent() {
34     // Assert that a translatable content is still translatable.
35     $config = $this->config('language.content_settings.node.blog');
36     $this->assertIdentical($config->get('target_entity_type_id'), 'node');
37     $this->assertIdentical($config->get('target_bundle'), 'blog');
38     $this->assertIdentical($config->get('default_langcode'), 'current_interface');
39     $this->assertFalse($config->get('language_alterable'));
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', 'page');
44     $this->assertTrue($config->isDefaultConfiguration());
45     $this->assertFalse($config->isLanguageAlterable());
46     $this->assertSame($config->getDefaultLangcode(), 'site_default');
47
48   }
49
50 }