reverted:
--- b/core/modules/content_translation/migration_templates/d6_i18n_block.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-id: d6_i18n_block
-label: i18n Blocks
-migration_tags:
- - Drupal 6
-source:
- plugin: d6_i18n_block
- constants:
- dest_label: 'settings/label'
-process:
- langcode: language
- property: constants/dest_label
- translation: title
- id:
- plugin: migration
- migration: d6_block
- source:
- - module
- - delta
- plugin:
- -
- plugin: static_map
- bypass: true
- source:
- - module
- - delta
- map:
- book:
- 0: book_navigation
- comment:
- 0: views_block:comments_recent-block_1
- forum:
- 0: forum_active_block
- 1: forum_new_block
- locale:
- 0: language_block
- node:
- 0: node_syndicate_block
- search:
- 0: search_form_block
- statistics:
- 0: statistics_popular_block
- system:
- 0: system_powered_by_block
- user:
- 0: user_login_block
- 1: system_menu_block:tools
- 2: views_block:who_s_new-block_1
- 3: views_block:who_s_online-who_s_online_block
- -
- plugin: block_plugin_id
- -
- plugin: skip_on_empty
- method: row
- theme:
- plugin: block_theme
- source:
- - theme
- - default_theme
- - admin_theme
-destination:
- plugin: entity:block
-migration_dependencies:
- required:
- - d6_block
reverted:
--- b/core/modules/content_translation/migration_templates/d6_i18n_custom_block.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-id: d6_i18n_custom_block
-label: Custom blocks
-migration_tags:
- - Drupal 6
-source:
- plugin: d6_i18n_box
- constants:
- type: basic
-process:
- id: bid
- langcode: language
- type: 'constants/type'
- info: info
- 'body/format':
- plugin: migration
- migration: d6_filter_format
- source: format
- 'body/value': body
-destination:
- plugin: entity:block_content
- no_stub: true
- translations: true
-migration_dependencies:
- required:
- - d6_filter_format
- - block_content_body_field
- - d6_custom_block
reverted:
--- b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBlock.php
+++ /dev/null
@@ -1,104 +0,0 @@
-getModuleSchemaVersion('system') >= 7000) {
- $this->blockTable = 'block';
- }
- else {
- $this->blockTable = 'blocks';
- }
-
- $query = $this->select('i18n_blocks', 'i18n')
- ->fields('i18n', ['ibid', 'module', 'delta', 'type', 'language'])
- ->fields('b', ['bid', 'module', 'delta', 'theme', 'title']);
- $query->addField('b', 'module', 'block_module');
- $query->addField('b', 'delta', 'block_delta');
- $query->leftJoin($this->blockTable, 'b', ('b.module = i18n.module AND b.delta = i18n.delta'));
- return $query;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function initializeIterator() {
- $this->defaultTheme = $this->variableGet('theme_default', 'Garland');
- $this->adminTheme = $this->variableGet('admin_theme', NULL);
- return parent::initializeIterator();
- }
-
- /**
- * {@inheritdoc}
- */
- public function fields() {
- return [
- 'bid' => $this->t('The block numeric identifier.'),
- 'module' => $this->t('The module providing the block.'),
- 'delta' => $this->t("The block's delta."),
- 'title' => $this->t("Title translation for this language.."),
- 'theme' => $this->t('Which theme the block is placed in.'),
- 'language' => $this->t('Language for this field.'),
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIds() {
- $ids['module']['type'] = 'string';
- $ids['module']['alias'] = 'b';
- $ids['delta']['type'] = 'string';
- $ids['delta']['alias'] = 'b';
- $ids['theme']['type'] = 'string';
- $ids['language']['type'] = 'string';
- return $ids;
- }
-
- /**
- * {@inheritdoc}
- */
- public function prepareRow(Row $row) {
- $row->setSourceProperty('default_theme', $this->defaultTheme);
- $row->setSourceProperty('admin_theme', $this->adminTheme);
- return parent::prepareRow($row);
- }
-
-}
reverted:
--- b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBox.php
+++ /dev/null
@@ -1,103 +0,0 @@
-initializeIterator()->count();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function initializeIterator() {
- return new \ArrayIterator($this->values());
- }
-
- /**
- * Merge the block body and info translations into a single row.
- *
- * @return array
- * An array of ...
- */
- protected function values() {
- $values = [];
- $result = $this->prepareQuery()->execute()->FetchAll();
- $cnt = count($result);
- for ($i = 0; $i < $cnt; $i++) {
- if (isset($result[$i])) {
- $j = $i + 1;
- if (isset($result[$j])) {
- // If the same bid and language, then this is the info.
- if ($result[$i]['bid'] == $result[$j]['bid'] and
- $result[$i]['language'] == $result[$j]['language']
- ) {
- $result[$i]['info'] = $result[$j]['info'];
- unset($result[$j]);
- }
- }
- $values[] = $result[$i];
- }
- }
- return $values;
- }
-
- /**
- * {@inheritdoc}
- */
- public function query() {
- $query = $this->select('i18n_strings', 'i18n')
- ->fields('i18n', ['lid', 'type', 'property', 'objectid'])
- ->fields('lt', ['lid', 'language', 'translation'])
- ->fields('b', ['bid', 'body', 'info', 'format'])
- ->orderBy('bid')
- ->orderBy('language')
- ->orderBy('property')
- ->condition('i18n.type', 'block');
- $query->addExpression(self::INFO, 'info');
- $query->addExpression(self::BODY, 'body');
- $query->leftJoin('boxes', 'b', 'b.bid = i18n.objectid');
- $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
-
- return $query;
- }
-
- /**
- * {@inheritdoc}
- */
- public function fields() {
- return [
- 'bid' => $this->t('The block numeric identifier.'),
- 'language' => $this->t('Language for this field.'),
- 'body' => $this->t('The block/box content'),
- 'info' => $this->t('Admin title of the block/box.'),
- 'format' => $this->t('Input format of the custom block/box content.'),
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIds() {
- $ids['bid']['type'] = 'integer';
- $ids['language']['type'] = 'string';
- return $ids;
- }
-
-}
reverted:
--- b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateI18nBlockContentTest.php
+++ /dev/null
@@ -1,54 +0,0 @@
-installConfig(['block']);
- $this->installConfig(['block_content']);
- $this->installEntitySchema('block_content');
-
- $this->executeMigrations([
- 'd6_filter_format',
- 'block_content_type',
- 'block_content_body_field',
- 'd6_custom_block',
- 'd6_user_role',
- 'd6_block',
- 'd6_i18n_block',
- ]);
- block_rebuild();
- }
-
- /**
- * Tests the migration of block title translation.
- */
- public function testI18nBlock() {
- $config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'block.block.user_1');
- $this->assertSame('zu - Test Title 02', $config->get('settings.label'));
- }
-
-}
reverted:
--- b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateI18nCustomBlockContentTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-installConfig(['block_content']);
- $this->installEntitySchema('block_content');
- ConfigurableLanguage::createFromLangcode('en')->save();
- ConfigurableLanguage::createFromLangcode('fr')->save();
- ConfigurableLanguage::createFromLangcode('zu')->save();
- $this->executeMigrations([
- 'd6_filter_format',
- 'block_content_type',
- 'block_content_body_field',
- 'd6_custom_block',
- 'd6_i18n_custom_block',
- ]);
- }
-
- /**
- * Tests the Drupal 6 i18n custom block strings to Drupal 8 migration.
- */
- public function testBlockMigration() {
- /** @var BlockContent $block */
- $block = BlockContent::load(1)->getTranslation('fr');
- $this->assertSame('fr - Static Block', $block->label());
- $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
- $this->assertSame('fr', $block->language()->getId());
- $this->assertSame('
fr - My first custom block body
', $block->body->value);
- $this->assertSame('full_html', $block->body->format);
-
- $block = BlockContent::load(1)->getTranslation('zu');
- $this->assertSame('My block 1', $block->label());
- $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
- $this->assertSame('zu', $block->language()->getId());
- $this->assertSame('zu - My first custom block body
', $block->body->value);
- $this->assertSame('full_html', $block->body->format);
-
- $block = BlockContent::load(2)->getTranslation('fr');
- $this->assertSame('Encore un bloc statique', $block->label());
- $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
- $this->assertSame('fr', $block->language()->getId());
- $this->assertSame('Nom de vocabulaire beaucoup plus long que trente-deux caractères', $block->body->value);
- $this->assertSame('full_html', $block->body->format);
- }
-
-}
reverted:
--- b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nBlockTest.php
+++ /dev/null
@@ -1,100 +0,0 @@
- 1,
- 'module' => 'user',
- 'delta' => '1',
- 'theme' => 'garland',
- 'status' => 1,
- 'weight' => 0,
- 'region' => 'left',
- 'visibility' => 0,
- 'pages' => '',
- 'title' => 'fr - Test Title 01',
- 'cache' => -1,
- ],
- [
- 'bid' => 2,
- 'module' => 'user',
- 'delta' => '2',
- 'theme' => 'garland',
- 'status' => 1,
- 'weight' => 5,
- 'region' => 'right',
- 'visibility' => 0,
- 'pages' => '',
- 'title' => 'zu - Test Title 02',
- 'cache' => -1,
- ],
- ];
-
- $tests[0]['source_data']['i18n_blocks'] = [
- [
- 'ibid' => 1,
- 'module' => 'user',
- 'delta' => '1',
- 'type' => 0,
- 'language' => 'fr',
- ],
- [
- 'ibid' => 2,
- 'module' => 'user',
- 'delta' => '2',
- 'type' => 0,
- 'language' => 'zu',
- ],
- ];
-
- // The expected results.
- $tests[0]['expected_results'] = [
- [
- 'bid' => 1,
- 'module' => 'user',
- 'delta' => '1',
- 'title' => 'fr - Test Title 01',
- 'ibid' => 1,
- 'type' => '0',
- 'language' => 'fr',
- ],
- [
- 'bid' => 2,
- 'module' => 'user',
- 'delta' => '2',
- 'theme' => 'garland',
- 'title' => 'zu - Test Title 02',
- 'ibid' => 2,
- 'type' => '0',
- 'language' => 'zu',
- ],
- ];
-
- return $tests;
- }
-
-}
reverted:
--- b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nBoxTest.php
+++ /dev/null
@@ -1,143 +0,0 @@
- 1,
- 'body' => 'box 1 body',
- 'info' => 'box 1 info',
- 'format' => '2',
- ],
- [
- 'bid' => 2,
- 'body' => 'box 2 body',
- 'info' => 'box 2 info',
- 'format' => '2',
- ],
- ];
-
- $tests[0]['database']['i18n_strings'] = [
- [
- 'lid' => 1,
- 'objectid' => 1,
- 'type' => 'block',
- 'property' => 'title',
- 'objectindex' => 0,
- 'format' => 0,
- ],
- [
- 'lid' => 2,
- 'objectid' => 1,
- 'type' => 'block',
- 'property' => 'body',
- 'objectindex' => 0,
- 'format' => 0,
- ],
- [
- 'lid' => 3,
- 'objectid' => 2,
- 'type' => 'block',
- 'property' => 'body',
- 'objectindex' => 0,
- 'format' => 2,
- ],
- ];
-
- $tests[0]['database']['locales_target'] = [
- [
- 'lid' => 1,
- 'language' => 'fr',
- 'translation' => 'fr - info translation',
- 'plid' => 0,
- 'plural' => 0,
- 'i18n_status' => 0,
- ],
- [
- 'lid' => 2,
- 'language' => 'fr',
- 'translation' => 'fr - body translation',
- 'plid' => 0,
- 'plural' => 0,
- 'i18n_status' => 0,
- ],
- [
- 'lid' => 2,
- 'language' => 'zu',
- 'translation' => 'zu - body translation',
- 'plid' => 0,
- 'plural' => 0,
- 'i18n_status' => 0,
- ],
- ];
-
- // The expected results.
- $tests[0]['expected_results'] = [
- [
- 'lid' => '2',
- 'type' => 'block',
- 'property' => 'body',
- 'objectid' => '1',
- 'lt_lid' => '2',
- 'language' => 'fr',
- 'translation' => 'fr - body translation',
- 'bid' => '1',
- 'body' => 'fr - body translation',
- 'info' => 'fr - info translation',
- 'format' => '2',
- ],
- [
- 'lid' => '2',
- 'type' => 'block',
- 'property' => 'body',
- 'objectid' => '1',
- 'lt_lid' => '2',
- 'language' => 'zu',
- 'translation' => 'zu - body translation',
- 'bid' => '1',
- 'body' => 'zu - body translation',
- 'info' => 'box 1 info',
- 'format' => '2',
- ],
- [
- 'lid' => '3',
- 'type' => 'block',
- 'property' => 'body',
- 'objectid' => '2',
- 'lt_lid' => NULL,
- 'language' => NULL,
- 'translation' => NULL,
- 'bid' => '2',
- 'body' => NULL,
- 'info' => 'box 2 info',
- 'format' => '2',
- ],
- ];
-
- return $tests;
- }
-
-}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/migration_templates/d6_block_translation.yml
@@ -0,0 +1,64 @@
+id: d6_block_translation
+label: Blocks translation
+migration_tags:
+ - Drupal 6
+source:
+ plugin: d6_block_translation
+ constants:
+ dest_label: 'settings/label'
+process:
+ langcode: language
+ property: constants/dest_label
+ translation: title
+ id:
+ plugin: migration
+ migration: d6_block
+ source:
+ - module
+ - delta
+ plugin:
+ -
+ plugin: static_map
+ bypass: true
+ source:
+ - module
+ - delta
+ map:
+ book:
+ 0: book_navigation
+ comment:
+ 0: views_block:comments_recent-block_1
+ forum:
+ 0: forum_active_block
+ 1: forum_new_block
+ locale:
+ 0: language_block
+ node:
+ 0: node_syndicate_block
+ search:
+ 0: search_form_block
+ statistics:
+ 0: statistics_popular_block
+ system:
+ 0: system_powered_by_block
+ user:
+ 0: user_login_block
+ 1: system_menu_block:tools
+ 2: views_block:who_s_new-block_1
+ 3: views_block:who_s_online-who_s_online_block
+ -
+ plugin: block_plugin_id
+ -
+ plugin: skip_on_empty
+ method: row
+ theme:
+ plugin: block_theme
+ source:
+ - theme
+ - default_theme
+ - admin_theme
+destination:
+ plugin: entity:block
+migration_dependencies:
+ required:
+ - d6_block
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/migration_templates/d6_custom_block_translation.yml
@@ -0,0 +1,27 @@
+id: d6_custom_block_translation
+label: Custom blocks
+migration_tags:
+ - Drupal 6
+source:
+ plugin: d6_box_translation
+ constants:
+ type: basic
+process:
+ id: bid
+ langcode: language
+ type: 'constants/type'
+ info: info
+ 'body/format':
+ plugin: migration
+ migration: d6_filter_format
+ source: format
+ 'body/value': body
+destination:
+ plugin: entity:block_content
+ no_stub: true
+ translations: true
+migration_dependencies:
+ required:
+ - d6_filter_format
+ - block_content_body_field
+ - d6_custom_block
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/src/Plugin/migrate/source/d6/BlockTranslation.php
@@ -0,0 +1,104 @@
+getModuleSchemaVersion('system') >= 7000) {
+ $this->blockTable = 'block';
+ }
+ else {
+ $this->blockTable = 'blocks';
+ }
+
+ $query = $this->select('i18n_blocks', 'i18n')
+ ->fields('i18n', ['ibid', 'module', 'delta', 'type', 'language'])
+ ->fields('b', ['bid', 'module', 'delta', 'theme', 'title']);
+ $query->addField('b', 'module', 'block_module');
+ $query->addField('b', 'delta', 'block_delta');
+ $query->leftJoin($this->blockTable, 'b', ('b.module = i18n.module AND b.delta = i18n.delta'));
+ return $query;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function initializeIterator() {
+ $this->defaultTheme = $this->variableGet('theme_default', 'Garland');
+ $this->adminTheme = $this->variableGet('admin_theme', NULL);
+ return parent::initializeIterator();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fields() {
+ return [
+ 'bid' => $this->t('The block numeric identifier.'),
+ 'module' => $this->t('The module providing the block.'),
+ 'delta' => $this->t("The block's delta."),
+ 'title' => $this->t("Title translation for this language.."),
+ 'theme' => $this->t('Which theme the block is placed in.'),
+ 'language' => $this->t('Language for this field.'),
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds() {
+ $ids['module']['type'] = 'string';
+ $ids['module']['alias'] = 'b';
+ $ids['delta']['type'] = 'string';
+ $ids['delta']['alias'] = 'b';
+ $ids['theme']['type'] = 'string';
+ $ids['language']['type'] = 'string';
+ return $ids;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function prepareRow(Row $row) {
+ $row->setSourceProperty('default_theme', $this->defaultTheme);
+ $row->setSourceProperty('admin_theme', $this->adminTheme);
+ return parent::prepareRow($row);
+ }
+
+}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/src/Plugin/migrate/source/d6/BoxTranslation.php
@@ -0,0 +1,103 @@
+initializeIterator()->count();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function initializeIterator() {
+ return new \ArrayIterator($this->values());
+ }
+
+ /**
+ * Merge the block body and info translations into a single row.
+ *
+ * @return array
+ * An array of ...
+ */
+ protected function values() {
+ $values = [];
+ $result = $this->prepareQuery()->execute()->FetchAll();
+ $cnt = count($result);
+ for ($i = 0; $i < $cnt; $i++) {
+ if (isset($result[$i])) {
+ $j = $i + 1;
+ if (isset($result[$j])) {
+ // If the same bid and language, then this is the info.
+ if ($result[$i]['bid'] == $result[$j]['bid'] and
+ $result[$i]['language'] == $result[$j]['language']
+ ) {
+ $result[$i]['info'] = $result[$j]['info'];
+ unset($result[$j]);
+ }
+ }
+ $values[] = $result[$i];
+ }
+ }
+ return $values;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function query() {
+ $query = $this->select('i18n_strings', 'i18n')
+ ->fields('i18n', ['lid', 'type', 'property', 'objectid'])
+ ->fields('lt', ['lid', 'language', 'translation'])
+ ->fields('b', ['bid', 'body', 'info', 'format'])
+ ->orderBy('bid')
+ ->orderBy('language')
+ ->orderBy('property')
+ ->condition('i18n.type', 'block');
+ $query->addExpression(self::INFO, 'info');
+ $query->addExpression(self::BODY, 'body');
+ $query->leftJoin('boxes', 'b', 'b.bid = i18n.objectid');
+ $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
+
+ return $query;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fields() {
+ return [
+ 'bid' => $this->t('The block numeric identifier.'),
+ 'language' => $this->t('Language for this field.'),
+ 'body' => $this->t('The block/box content'),
+ 'info' => $this->t('Admin title of the block/box.'),
+ 'format' => $this->t('Input format of the custom block/box content.'),
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIds() {
+ $ids['bid']['type'] = 'integer';
+ $ids['language']['type'] = 'string';
+ return $ids;
+ }
+
+}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php
@@ -0,0 +1,54 @@
+installConfig(['block']);
+ $this->installConfig(['block_content']);
+ $this->installEntitySchema('block_content');
+
+ $this->executeMigrations([
+ 'd6_filter_format',
+ 'block_content_type',
+ 'block_content_body_field',
+ 'd6_custom_block',
+ 'd6_user_role',
+ 'd6_block',
+ 'd6_block_translation',
+ ]);
+ block_rebuild();
+ }
+
+ /**
+ * Tests the migration of block title translation.
+ */
+ public function testI18nBlock() {
+ $config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'block.block.user_1');
+ $this->assertSame('zu - Test Title 02', $config->get('settings.label'));
+ }
+
+}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateCustomBlockContentTranslationTest.php
@@ -0,0 +1,73 @@
+installConfig(['block_content']);
+ $this->installEntitySchema('block_content');
+ ConfigurableLanguage::createFromLangcode('en')->save();
+ ConfigurableLanguage::createFromLangcode('fr')->save();
+ ConfigurableLanguage::createFromLangcode('zu')->save();
+ $this->executeMigrations([
+ 'd6_filter_format',
+ 'block_content_type',
+ 'block_content_body_field',
+ 'd6_custom_block',
+ 'd6_custom_block_translation',
+ ]);
+ }
+
+ /**
+ * Tests the Drupal 6 i18n custom block strings to Drupal 8 migration.
+ */
+ public function testBlockMigration() {
+ /** @var BlockContent $block */
+ $block = BlockContent::load(1)->getTranslation('fr');
+ $this->assertSame('fr - Static Block', $block->label());
+ $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
+ $this->assertSame('fr', $block->language()->getId());
+ $this->assertSame('fr - My first custom block body
', $block->body->value);
+ $this->assertSame('full_html', $block->body->format);
+
+ $block = BlockContent::load(1)->getTranslation('zu');
+ $this->assertSame('My block 1', $block->label());
+ $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
+ $this->assertSame('zu', $block->language()->getId());
+ $this->assertSame('zu - My first custom block body
', $block->body->value);
+ $this->assertSame('full_html', $block->body->format);
+
+ $block = BlockContent::load(2)->getTranslation('fr');
+ $this->assertSame('Encore un bloc statique', $block->label());
+ $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
+ $this->assertSame('fr', $block->language()->getId());
+ $this->assertSame('Nom de vocabulaire beaucoup plus long que trente-deux caractères', $block->body->value);
+ $this->assertSame('full_html', $block->body->format);
+ }
+
+}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/BlockTranslationTest.php
@@ -0,0 +1,100 @@
+ 1,
+ 'module' => 'user',
+ 'delta' => '1',
+ 'theme' => 'garland',
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'left',
+ 'visibility' => 0,
+ 'pages' => '',
+ 'title' => 'fr - Test Title 01',
+ 'cache' => -1,
+ ],
+ [
+ 'bid' => 2,
+ 'module' => 'user',
+ 'delta' => '2',
+ 'theme' => 'garland',
+ 'status' => 1,
+ 'weight' => 5,
+ 'region' => 'right',
+ 'visibility' => 0,
+ 'pages' => '',
+ 'title' => 'zu - Test Title 02',
+ 'cache' => -1,
+ ],
+ ];
+
+ $tests[0]['source_data']['i18n_blocks'] = [
+ [
+ 'ibid' => 1,
+ 'module' => 'user',
+ 'delta' => '1',
+ 'type' => 0,
+ 'language' => 'fr',
+ ],
+ [
+ 'ibid' => 2,
+ 'module' => 'user',
+ 'delta' => '2',
+ 'type' => 0,
+ 'language' => 'zu',
+ ],
+ ];
+
+ // The expected results.
+ $tests[0]['expected_results'] = [
+ [
+ 'bid' => 1,
+ 'module' => 'user',
+ 'delta' => '1',
+ 'title' => 'fr - Test Title 01',
+ 'ibid' => 1,
+ 'type' => '0',
+ 'language' => 'fr',
+ ],
+ [
+ 'bid' => 2,
+ 'module' => 'user',
+ 'delta' => '2',
+ 'theme' => 'garland',
+ 'title' => 'zu - Test Title 02',
+ 'ibid' => 2,
+ 'type' => '0',
+ 'language' => 'zu',
+ ],
+ ];
+
+ return $tests;
+ }
+
+}
only in patch2:
unchanged:
--- /dev/null
+++ b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php
@@ -0,0 +1,143 @@
+ 1,
+ 'body' => 'box 1 body',
+ 'info' => 'box 1 info',
+ 'format' => '2',
+ ],
+ [
+ 'bid' => 2,
+ 'body' => 'box 2 body',
+ 'info' => 'box 2 info',
+ 'format' => '2',
+ ],
+ ];
+
+ $tests[0]['database']['i18n_strings'] = [
+ [
+ 'lid' => 1,
+ 'objectid' => 1,
+ 'type' => 'block',
+ 'property' => 'title',
+ 'objectindex' => 0,
+ 'format' => 0,
+ ],
+ [
+ 'lid' => 2,
+ 'objectid' => 1,
+ 'type' => 'block',
+ 'property' => 'body',
+ 'objectindex' => 0,
+ 'format' => 0,
+ ],
+ [
+ 'lid' => 3,
+ 'objectid' => 2,
+ 'type' => 'block',
+ 'property' => 'body',
+ 'objectindex' => 0,
+ 'format' => 2,
+ ],
+ ];
+
+ $tests[0]['database']['locales_target'] = [
+ [
+ 'lid' => 1,
+ 'language' => 'fr',
+ 'translation' => 'fr - info translation',
+ 'plid' => 0,
+ 'plural' => 0,
+ 'i18n_status' => 0,
+ ],
+ [
+ 'lid' => 2,
+ 'language' => 'fr',
+ 'translation' => 'fr - body translation',
+ 'plid' => 0,
+ 'plural' => 0,
+ 'i18n_status' => 0,
+ ],
+ [
+ 'lid' => 2,
+ 'language' => 'zu',
+ 'translation' => 'zu - body translation',
+ 'plid' => 0,
+ 'plural' => 0,
+ 'i18n_status' => 0,
+ ],
+ ];
+
+ // The expected results.
+ $tests[0]['expected_results'] = [
+ [
+ 'lid' => '2',
+ 'type' => 'block',
+ 'property' => 'body',
+ 'objectid' => '1',
+ 'lt_lid' => '2',
+ 'language' => 'fr',
+ 'translation' => 'fr - body translation',
+ 'bid' => '1',
+ 'body' => 'fr - body translation',
+ 'info' => 'fr - info translation',
+ 'format' => '2',
+ ],
+ [
+ 'lid' => '2',
+ 'type' => 'block',
+ 'property' => 'body',
+ 'objectid' => '1',
+ 'lt_lid' => '2',
+ 'language' => 'zu',
+ 'translation' => 'zu - body translation',
+ 'bid' => '1',
+ 'body' => 'zu - body translation',
+ 'info' => 'box 1 info',
+ 'format' => '2',
+ ],
+ [
+ 'lid' => '3',
+ 'type' => 'block',
+ 'property' => 'body',
+ 'objectid' => '2',
+ 'lt_lid' => NULL,
+ 'language' => NULL,
+ 'translation' => NULL,
+ 'bid' => '2',
+ 'body' => NULL,
+ 'info' => 'box 2 info',
+ 'format' => '2',
+ ],
+ ];
+
+ return $tests;
+ }
+
+}