diff --git a/metatag.module b/metatag.module index b8dab07..1d7f778 100644 --- a/metatag.module +++ b/metatag.module @@ -509,7 +509,7 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M $source_can_have_metatags = in_array($source->getPluginId(), [ 'd7_node', 'd7_node_revision', - 'taxonomy_term', + 'd7_taxonomy_term', 'd7_user' ]); if ($source_can_have_metatags && $migration->getDestinationPlugin() instanceof EntityContentBase) { @@ -526,7 +526,7 @@ function metatag_migrate_prepare_row(Row $row, MigrateSourceInterface $source, M $revision_id = $row->getSourceProperty('vid'); break; - case 'taxonomy_term': + case 'd7_taxonomy_term': $entity_type = 'taxonomy_term'; $entity_id = $row->getSourceProperty('tid'); break; diff --git a/tests/fixtures/drupal7.php b/tests/fixtures/drupal7.php index 8852e23..58f1cc7 100644 --- a/tests/fixtures/drupal7.php +++ b/tests/fixtures/drupal7.php @@ -88,7 +88,7 @@ $connection->insert('metatag') )) ->values(array( 'entity_type' => 'taxonomy_term', - 'entity_id' => '2', + 'entity_id' => '152', 'revision_id' => '0', 'language' => 'und', 'data' => 'a:1:{s:8:"keywords";a:1:{s:5:"value";s:12:"keytaxonomy2";}}', @@ -179,7 +179,7 @@ $connection->insert('taxonomy_term_data') 'weight', )) ->values(array( - '2', + '152', '1', 'A Term', '', diff --git a/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php b/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php index 9a4831b..280256d 100644 --- a/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php +++ b/tests/src/Kernel/Migrate/d7/MigrateMetatagTest.php @@ -7,6 +7,7 @@ use Drupal\node\NodeInterface; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\TermInterface; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; +use Drupal\Tests\file\Kernel\Migrate\d7\FileMigrationSetupTrait; use Drupal\user\Entity\User; use Drupal\user\UserInterface; @@ -17,6 +18,8 @@ use Drupal\user\UserInterface; */ class MigrateMetatagTest extends MigrateDrupal7TestBase { + use FileMigrationSetupTrait; + static $modules = [ 'metatag', 'comment', @@ -41,7 +44,6 @@ class MigrateMetatagTest extends MigrateDrupal7TestBase { $this->installEntitySchema('node'); $this->installEntitySchema('comment'); $this->installEntitySchema('taxonomy_term'); - $this->installEntitySchema('file'); $this->installConfig(static::$modules); $this->installSchema('node', ['node_access']); $this->installSchema('system', ['sequences']); @@ -57,8 +59,12 @@ class MigrateMetatagTest extends MigrateDrupal7TestBase { 'd7_comment_type', 'd7_field', 'd7_field_instance', + ]); + $this->fileMigrationSetup(); + $this->executeMigrations([ 'd7_node:test_content_type', 'd7_node:article', + 'd7_node:forum', 'd7_node_revision:test_content_type', 'd7_taxonomy_term', ]); @@ -86,7 +92,7 @@ class MigrateMetatagTest extends MigrateDrupal7TestBase { $this->assertSame('a:1:{s:8:"keywords";a:1:{s:5:"value";s:7:"keyuser";}}', $user->field_metatag->value); /** @var Term $term */ - $term = Term::load(2); + $term = Term::load(152); $this->assertTrue($term instanceof TermInterface); $this->assertTrue($term->hasField('field_metatag')); $this->assertSame('a:1:{s:8:"keywords";a:1:{s:5:"value";s:12:"keytaxonomy2";}}', $term->field_metatag->value);