Loading core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php 0 → 100644 +80 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\field\Kernel\Migrate\d7; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** * Migrate field instance option translations. * * @group migrate_drupal_7 */ class MigrateFieldInstanceOptionTranslationTest extends MigrateDrupal7TestBase { /** * {@inheritdoc} */ public static $modules = [ 'comment', 'config_translation', 'datetime', 'file', 'image', 'language', 'link', 'locale', 'menu_ui', 'node', 'system', 'taxonomy', 'telephone', 'text', ]; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(['node']); $this->executeMigration('language'); $this->migrateFields(); $this->executeMigrations([ 'd7_field_option_translation', 'd7_field_instance_option_translation', ]); } /** * Migrate field instance option translations. */ public function testFieldInstanceOptionTranslation() { $language_manager = $this->container->get('language_manager'); /** @var \Drupal\language\Config\LanguageConfigOverride $config_translation */ $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.test_content_type.field_boolean'); $this->assertNull($config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_boolean'); $option_translation = [ 'off_label' => 'is - Off', 'on_label' => 'is - 1', ]; $this->assertSame($option_translation, $config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.article.field_checkbox'); $option_translation = [ 'off_label' => 'fr - Stop', 'on_label' => 'Go', ]; $this->assertSame($option_translation, $config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.article.field_checkbox'); $option_translation = [ 'off_label' => 'is - Stop', 'on_label' => 'is - Go', ]; $this->assertSame($option_translation, $config_translation->get('settings')); } } core/modules/migrate_drupal/tests/fixtures/drupal7.php +241 −0 Original line number Diff line number Diff line Loading @@ -4311,6 +4311,21 @@ 'translatable' => '0', 'deleted' => '0', )) ->values(array( 'id' => '53', 'field_name' => 'field_checkbox', 'type' => 'list_boolean', 'module' => 'list', 'active' => '1', 'storage_type' => 'field_sql_storage', 'storage_module' => 'field_sql_storage', 'storage_active' => '1', 'locked' => '0', 'data' => 'a:7:{s:12:"translatable";i:0;s:12:"entity_types";a:0:{}s:8:"settings";a:3:{s:14:"allowed_values";a:2:{i:0;s:4:"Stop";i:1;s:2:"Go";}s:23:"allowed_values_function";s:0:"";s:23:"entity_translation_sync";b:0;}s:7:"storage";a:5:{s:4:"type";s:17:"field_sql_storage";s:8:"settings";a:0:{}s:6:"module";s:17:"field_sql_storage";s:6:"active";s:1:"1";s:7:"details";a:1:{s:3:"sql";a:2:{s:18:"FIELD_LOAD_CURRENT";a:1:{s:25:"field_data_field_checkbox";a:1:{s:5:"value";s:20:"field_checkbox_value";}}s:19:"FIELD_LOAD_REVISION";a:1:{s:29:"field_revision_field_checkbox";a:1:{s:5:"value";s:20:"field_checkbox_value";}}}}}s:12:"foreign keys";a:0:{}s:7:"indexes";a:1:{s:5:"value";a:1:{i:0;s:5:"value";}}s:2:"id";s:2:"53";}', 'cardinality' => '1', 'translatable' => '0', 'deleted' => '0', )) ->execute(); $connection->schema()->createTable('field_config_instance', array( 'fields' => array( Loading Loading @@ -5072,6 +5087,15 @@ 'data' => 'a:7:{s:5:"label";s:10:"Chancellor";s:6:"widget";a:5:{s:6:"weight";s:1:"1";s:4:"type";s:14:"text_textfield";s:6:"module";s:4:"text";s:6:"active";i:1;s:8:"settings";a:1:{s:4:"size";s:2:"60";}}s:8:"settings";a:2:{s:15:"text_processing";s:1:"0";s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:12:"text_default";s:8:"settings";a:0:{}s:6:"module";s:4:"text";s:6:"weight";i:0;}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}', 'deleted' => '0', )) ->values(array( 'id' => '82', 'field_id' => '53', 'field_name' => 'field_checkbox', 'entity_type' => 'node', 'bundle' => 'article', 'data' => 'a:7:{s:5:"label";s:8:"checkbox";s:6:"widget";a:5:{s:6:"weight";s:2:"25";s:4:"type";s:15:"options_buttons";s:6:"module";s:7:"options";s:6:"active";i:1;s:8:"settings";a:0:{}}s:8:"settings";a:2:{s:18:"user_register_form";b:0;s:23:"entity_translation_sync";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:12:"list_default";s:8:"settings";a:0:{}s:6:"module";s:4:"list";s:6:"weight";i:25;}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}', 'deleted' => '0', )) ->execute(); $connection->schema()->createTable('field_data_body', array( 'fields' => array( Loading Loading @@ -5217,6 +5241,88 @@ 'body_format' => 'filtered_html', )) ->execute(); $connection->schema()->createTable('field_data_field_checkbox', array( 'fields' => array( 'entity_type' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'bundle' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'deleted' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'tiny', 'default' => '0', ), 'entity_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'revision_id' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', 'unsigned' => TRUE, ), 'language' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '32', 'default' => '', ), 'delta' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'field_checkbox_value' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', ), ), 'primary key' => array( 'entity_type', 'entity_id', 'deleted', 'delta', 'language', ), 'indexes' => array( 'entity_type' => array( 'entity_type', ), 'bundle' => array( 'bundle', ), 'deleted' => array( 'deleted', ), 'entity_id' => array( 'entity_id', ), 'revision_id' => array( 'revision_id', ), 'language' => array( 'language', ), 'field_checkbox_value' => array( 'field_checkbox_value', ), ), 'mysql_character_set' => 'utf8', )); $connection->schema()->createTable('field_data_comment_body', array( 'fields' => array( 'entity_type' => array( Loading Loading @@ -11217,6 +11323,89 @@ 'field_chancellor_format' => NULL, )) ->execute(); $connection->schema()->createTable('field_revision_field_checkbox', array( 'fields' => array( 'entity_type' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'bundle' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'deleted' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'tiny', 'default' => '0', ), 'entity_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'revision_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'language' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '32', 'default' => '', ), 'delta' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'field_checkbox_value' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', ), ), 'primary key' => array( 'entity_type', 'entity_id', 'revision_id', 'deleted', 'delta', 'language', ), 'indexes' => array( 'entity_type' => array( 'entity_type', ), 'bundle' => array( 'bundle', ), 'deleted' => array( 'deleted', ), 'entity_id' => array( 'entity_id', ), 'revision_id' => array( 'revision_id', ), 'language' => array( 'language', ), 'field_checkbox_value' => array( 'field_checkbox_value', ), ), 'mysql_character_set' => 'utf8', )); $connection->schema()->createTable('field_revision_field_color', array( 'fields' => array( 'entity_type' => array( Loading Loading @@ -18306,6 +18495,26 @@ 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '797', 'textgroup' => 'field', 'context' => 'field_checkbox:#allowed_values:0', 'objectid' => '#allowed_values', 'type' => 'field_checkbox', 'property' => '0', 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '798', 'textgroup' => 'field', 'context' => 'field_checkbox:#allowed_values:1', 'objectid' => '#allowed_values', 'type' => 'field_checkbox', 'property' => '1', 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '194', 'textgroup' => 'field', Loading Loading @@ -19904,6 +20113,38 @@ 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '797', 'translation' => 'is - Stop', 'language' => 'is', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '798', 'translation' => 'is - Go', 'language' => 'is', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '797', 'translation' => 'fr - Stop', 'language' => 'fr', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '798', 'translation' => 'Go', 'language' => 'fr', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->execute(); $connection->schema()->createTable('menu_custom', array( 'fields' => array( core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +2 −2 Original line number Diff line number Diff line Loading @@ -74,8 +74,8 @@ protected function getEntityCounts() { 'contact_form' => 3, 'contact_message' => 0, 'editor' => 2, 'field_config' => 76, 'field_storage_config' => 58, 'field_config' => 77, 'field_storage_config' => 59, 'file' => 3, 'filter_format' => 7, 'image_style' => 6, Loading Loading
core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php 0 → 100644 +80 −0 Original line number Diff line number Diff line <?php namespace Drupal\Tests\field\Kernel\Migrate\d7; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** * Migrate field instance option translations. * * @group migrate_drupal_7 */ class MigrateFieldInstanceOptionTranslationTest extends MigrateDrupal7TestBase { /** * {@inheritdoc} */ public static $modules = [ 'comment', 'config_translation', 'datetime', 'file', 'image', 'language', 'link', 'locale', 'menu_ui', 'node', 'system', 'taxonomy', 'telephone', 'text', ]; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(['node']); $this->executeMigration('language'); $this->migrateFields(); $this->executeMigrations([ 'd7_field_option_translation', 'd7_field_instance_option_translation', ]); } /** * Migrate field instance option translations. */ public function testFieldInstanceOptionTranslation() { $language_manager = $this->container->get('language_manager'); /** @var \Drupal\language\Config\LanguageConfigOverride $config_translation */ $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.test_content_type.field_boolean'); $this->assertNull($config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_boolean'); $option_translation = [ 'off_label' => 'is - Off', 'on_label' => 'is - 1', ]; $this->assertSame($option_translation, $config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.article.field_checkbox'); $option_translation = [ 'off_label' => 'fr - Stop', 'on_label' => 'Go', ]; $this->assertSame($option_translation, $config_translation->get('settings')); $config_translation = $language_manager->getLanguageConfigOverride('is', 'field.field.node.article.field_checkbox'); $option_translation = [ 'off_label' => 'is - Stop', 'on_label' => 'is - Go', ]; $this->assertSame($option_translation, $config_translation->get('settings')); } }
core/modules/migrate_drupal/tests/fixtures/drupal7.php +241 −0 Original line number Diff line number Diff line Loading @@ -4311,6 +4311,21 @@ 'translatable' => '0', 'deleted' => '0', )) ->values(array( 'id' => '53', 'field_name' => 'field_checkbox', 'type' => 'list_boolean', 'module' => 'list', 'active' => '1', 'storage_type' => 'field_sql_storage', 'storage_module' => 'field_sql_storage', 'storage_active' => '1', 'locked' => '0', 'data' => 'a:7:{s:12:"translatable";i:0;s:12:"entity_types";a:0:{}s:8:"settings";a:3:{s:14:"allowed_values";a:2:{i:0;s:4:"Stop";i:1;s:2:"Go";}s:23:"allowed_values_function";s:0:"";s:23:"entity_translation_sync";b:0;}s:7:"storage";a:5:{s:4:"type";s:17:"field_sql_storage";s:8:"settings";a:0:{}s:6:"module";s:17:"field_sql_storage";s:6:"active";s:1:"1";s:7:"details";a:1:{s:3:"sql";a:2:{s:18:"FIELD_LOAD_CURRENT";a:1:{s:25:"field_data_field_checkbox";a:1:{s:5:"value";s:20:"field_checkbox_value";}}s:19:"FIELD_LOAD_REVISION";a:1:{s:29:"field_revision_field_checkbox";a:1:{s:5:"value";s:20:"field_checkbox_value";}}}}}s:12:"foreign keys";a:0:{}s:7:"indexes";a:1:{s:5:"value";a:1:{i:0;s:5:"value";}}s:2:"id";s:2:"53";}', 'cardinality' => '1', 'translatable' => '0', 'deleted' => '0', )) ->execute(); $connection->schema()->createTable('field_config_instance', array( 'fields' => array( Loading Loading @@ -5072,6 +5087,15 @@ 'data' => 'a:7:{s:5:"label";s:10:"Chancellor";s:6:"widget";a:5:{s:6:"weight";s:1:"1";s:4:"type";s:14:"text_textfield";s:6:"module";s:4:"text";s:6:"active";i:1;s:8:"settings";a:1:{s:4:"size";s:2:"60";}}s:8:"settings";a:2:{s:15:"text_processing";s:1:"0";s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:12:"text_default";s:8:"settings";a:0:{}s:6:"module";s:4:"text";s:6:"weight";i:0;}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}', 'deleted' => '0', )) ->values(array( 'id' => '82', 'field_id' => '53', 'field_name' => 'field_checkbox', 'entity_type' => 'node', 'bundle' => 'article', 'data' => 'a:7:{s:5:"label";s:8:"checkbox";s:6:"widget";a:5:{s:6:"weight";s:2:"25";s:4:"type";s:15:"options_buttons";s:6:"module";s:7:"options";s:6:"active";i:1;s:8:"settings";a:0:{}}s:8:"settings";a:2:{s:18:"user_register_form";b:0;s:23:"entity_translation_sync";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:12:"list_default";s:8:"settings";a:0:{}s:6:"module";s:4:"list";s:6:"weight";i:25;}}s:8:"required";i:0;s:11:"description";s:0:"";s:13:"default_value";N;}', 'deleted' => '0', )) ->execute(); $connection->schema()->createTable('field_data_body', array( 'fields' => array( Loading Loading @@ -5217,6 +5241,88 @@ 'body_format' => 'filtered_html', )) ->execute(); $connection->schema()->createTable('field_data_field_checkbox', array( 'fields' => array( 'entity_type' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'bundle' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'deleted' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'tiny', 'default' => '0', ), 'entity_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'revision_id' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', 'unsigned' => TRUE, ), 'language' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '32', 'default' => '', ), 'delta' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'field_checkbox_value' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', ), ), 'primary key' => array( 'entity_type', 'entity_id', 'deleted', 'delta', 'language', ), 'indexes' => array( 'entity_type' => array( 'entity_type', ), 'bundle' => array( 'bundle', ), 'deleted' => array( 'deleted', ), 'entity_id' => array( 'entity_id', ), 'revision_id' => array( 'revision_id', ), 'language' => array( 'language', ), 'field_checkbox_value' => array( 'field_checkbox_value', ), ), 'mysql_character_set' => 'utf8', )); $connection->schema()->createTable('field_data_comment_body', array( 'fields' => array( 'entity_type' => array( Loading Loading @@ -11217,6 +11323,89 @@ 'field_chancellor_format' => NULL, )) ->execute(); $connection->schema()->createTable('field_revision_field_checkbox', array( 'fields' => array( 'entity_type' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'bundle' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '128', 'default' => '', ), 'deleted' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'tiny', 'default' => '0', ), 'entity_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'revision_id' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'language' => array( 'type' => 'varchar', 'not null' => TRUE, 'length' => '32', 'default' => '', ), 'delta' => array( 'type' => 'int', 'not null' => TRUE, 'size' => 'normal', 'unsigned' => TRUE, ), 'field_checkbox_value' => array( 'type' => 'int', 'not null' => FALSE, 'size' => 'normal', ), ), 'primary key' => array( 'entity_type', 'entity_id', 'revision_id', 'deleted', 'delta', 'language', ), 'indexes' => array( 'entity_type' => array( 'entity_type', ), 'bundle' => array( 'bundle', ), 'deleted' => array( 'deleted', ), 'entity_id' => array( 'entity_id', ), 'revision_id' => array( 'revision_id', ), 'language' => array( 'language', ), 'field_checkbox_value' => array( 'field_checkbox_value', ), ), 'mysql_character_set' => 'utf8', )); $connection->schema()->createTable('field_revision_field_color', array( 'fields' => array( 'entity_type' => array( Loading Loading @@ -18306,6 +18495,26 @@ 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '797', 'textgroup' => 'field', 'context' => 'field_checkbox:#allowed_values:0', 'objectid' => '#allowed_values', 'type' => 'field_checkbox', 'property' => '0', 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '798', 'textgroup' => 'field', 'context' => 'field_checkbox:#allowed_values:1', 'objectid' => '#allowed_values', 'type' => 'field_checkbox', 'property' => '1', 'objectindex' => '0', 'format' => '', )) ->values(array( 'lid' => '194', 'textgroup' => 'field', Loading Loading @@ -19904,6 +20113,38 @@ 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '797', 'translation' => 'is - Stop', 'language' => 'is', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '798', 'translation' => 'is - Go', 'language' => 'is', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '797', 'translation' => 'fr - Stop', 'language' => 'fr', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->values(array( 'lid' => '798', 'translation' => 'Go', 'language' => 'fr', 'plid' => '0', 'plural' => '0', 'i18n_status' => '0', )) ->execute(); $connection->schema()->createTable('menu_custom', array( 'fields' => array(
core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +2 −2 Original line number Diff line number Diff line Loading @@ -74,8 +74,8 @@ protected function getEntityCounts() { 'contact_form' => 3, 'contact_message' => 0, 'editor' => 2, 'field_config' => 76, 'field_storage_config' => 58, 'field_config' => 77, 'field_storage_config' => 59, 'file' => 3, 'filter_format' => 7, 'image_style' => 6, Loading