diff --git a/core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php b/core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php index fa54c70aac..15ad5dfe95 100644 --- a/core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php +++ b/core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php @@ -28,15 +28,15 @@ public function query() { if ($this->database->schema()->fieldExists('taxonomy_term_data', 'language')) { $query->addField('td', 'language', 'td_language'); } - // Get data when the i18n_mode column exists and it is not the Drupal 7 - // value I18N_MODE_NONE or I18N_MODE_LOCALIZE. + // Get data when the i18n_mode column exists and it is not the Drupal 7 + // value I18N_MODE_NONE or I18N_MODE_LOCALIZE. Otherwise, return no data. // @see https://git.drupalcode.org/project/i18n/-/blob/7.x-1.x/i18n.module#L26 if ($this->database->schema()->fieldExists('taxonomy_vocabulary', 'i18n_mode')) { $query->addField('tv', 'i18n_mode'); $query->condition('tv.i18n_mode', ['0', '1'], 'NOT IN'); } else { - $query->condition('td.tid', '0'); + $query->alwaysFalse(); } return $query; diff --git a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/TermTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/TermTranslationTest.php index 2573b79b34..a218b3ec3e 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/TermTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/TermTranslationTest.php @@ -345,6 +345,16 @@ public function providerSource() { $tests[1]['expected_count'] = NULL; $tests[1]['configuration']['bundle'] = NULL; + + // No data returned when there is no i18n_mode column. + $tests[2] = []; + $tests[2]['source_data'] = $tests[0]['source_data']; + foreach ($tests[2]['source_data']['taxonomy_vocabulary'] as &$table) { + unset($table['i18n_mode']); + } + $tests[2]['expected_data'] = [0]; + $tests[2]['expected_count'] = 0; + return $tests; }