diff --git a/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php b/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php index 4169baf..7bc1245 100644 --- a/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php +++ b/core/modules/book/src/Tests/Migrate/d6/MigrateBookTest.php @@ -27,6 +27,7 @@ class MigrateBookTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('file'); $this->installSchema('book', ['book']); $this->installSchema('node', ['node_access']); $this->migrateContent(); diff --git a/core/modules/comment/src/Tests/Migrate/d6/MigrateCommentTest.php b/core/modules/comment/src/Tests/Migrate/d6/MigrateCommentTest.php index 7219d95..bf60e07 100644 --- a/core/modules/comment/src/Tests/Migrate/d6/MigrateCommentTest.php +++ b/core/modules/comment/src/Tests/Migrate/d6/MigrateCommentTest.php @@ -30,6 +30,7 @@ class MigrateCommentTest extends MigrateDrupal6TestBase { protected function setUp() { parent::setUp(); + $this->installEntitySchema('file'); $this->installEntitySchema('node'); $this->installEntitySchema('comment'); $this->installSchema('comment', ['comment_entity_statistics']); diff --git a/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php index 4270b79..954b145 100644 --- a/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php +++ b/core/modules/file/src/Plugin/migrate/process/d6/CckFile.php @@ -75,35 +75,13 @@ public static function create(ContainerInterface $container, array $configuratio */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { $options = unserialize($value['data']); - - // Try to look up the ID of the migrated file. If one cannot be found, it - // means the file referenced by the current field item did not migrate for - // some reason -- file migration is notoriously brittle -- and we do NOT - // want to send invalid file references into the field system (it causes - // fatals), so return an empty item instead. - try { - $fid = $this->migrationPlugin->transform($value['fid'], $migrate_executable, $row, $destination_property); - } - // If the migration plugin completely fails its lookup process, it will - // throw a MigrateSkipRowException. It shouldn't, but that is being dealt - // with at https://www.drupal.org/node/2487568. Until that lands, return - // an empty item. - catch (MigrateSkipRowException $e) { - return []; - } - - if ($fid) { - return [ - 'target_id' => $fid, - 'display' => $value['list'], - 'description' => isset($options['description']) ? $options['description'] : '', - 'alt' => isset($options['alt']) ? $options['alt'] : '', - 'title' => isset($options['title']) ? $options['title'] : '', - ]; - } - else { - return []; - } + return [ + 'target_id' => $value['fid'], + 'display' => $value['list'], + 'description' => isset($options['description']) ? $options['description'] : '', + 'alt' => isset($options['alt']) ? $options['alt'] : '', + 'title' => isset($options['title']) ? $options['title'] : '', + ]; } } diff --git a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php index b8ee0c2..6fde36c 100644 --- a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeRevisionTest.php @@ -19,6 +19,7 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('file'); $this->executeMigrations(['d6_node:*', 'd6_node_revision:*']); } diff --git a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php index b25c270..dc411af 100644 --- a/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php +++ b/core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php @@ -20,11 +20,19 @@ */ class MigrateNodeTest extends MigrateNodeTestBase { + static $modules = [ + 'node', + 'taxonomy', + ]; + /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('taxonomy_term'); + $this->installEntitySchema('file'); + $this->installConfig(static::$modules); $this->executeMigrations(['d6_node:*']); } @@ -45,6 +53,10 @@ public function testNode() { $this->assertIdentical('1', $node->getOwnerId()); $this->assertIdentical('1420861423', $node->getRevisionCreationTime()); + $this->assertIdentical('5', $node->field_test_filefield->target_id); + $this->assertTrue($node->field_test_filefield->display); + $this->assertIdentical('desc', $node->field_test_filefield->description); + /** @var \Drupal\node\NodeInterface $node_revision */ $node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1); $this->assertIdentical('Test title', $node_revision->getTitle()); diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeRevisionTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeRevisionTest.php index 5dc9962..9dc2b3a 100644 --- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeRevisionTest.php +++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeRevisionTest.php @@ -26,6 +26,7 @@ class MigrateTermNodeRevisionTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('file'); $this->installSchema('node', ['node_access']); $this->migrateContent(TRUE); $this->migrateTaxonomy(); diff --git a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php index 8bf9e17..1189be7 100644 --- a/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php +++ b/core/modules/taxonomy/src/Tests/Migrate/d6/MigrateTermNodeTest.php @@ -30,6 +30,7 @@ class MigrateTermNodeTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('file'); $this->installSchema('node', ['node_access']); $this->migrateContent(); $this->migrateTaxonomy();