diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php new file mode 100644 index 0000000000000000000000000000000000000000..42927698266dafce3dec7e549cadc5c3aa3e9791 --- /dev/null +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php @@ -0,0 +1,43 @@ +coreModuleListDataProvider()); + parent::setUp(); + } + + /** + * Tests that calling getProcess() on a migration does not throw an exception. + * + * @throws \Exception + */ + public function testGetProcess() { + /** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager */ + $plugin_manager = $this->container->get('plugin.manager.migration'); + $migrations = $plugin_manager->createInstancesByTag('Drupal 6'); + foreach ($migrations as $migration) { + try { + $process = $migration->getProcess(); + } + catch (\Exception $e) { + $this->fail(sprintf("Migration %s process failed with error: %s", $migration->label(), $e->getMessage())); + } + $this->assertNotNull($process); + } + } + +} diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4f3826f67e18e6361d249acfca1882d0541327fd --- /dev/null +++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php @@ -0,0 +1,43 @@ +coreModuleListDataProvider()); + parent::setUp(); + } + + /** + * Tests that calling getProcess() on a migration does not throw an exception. + * + * @throws \Exception + */ + public function testGetProcess() { + /** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager */ + $plugin_manager = $this->container->get('plugin.manager.migration'); + $migrations = $plugin_manager->createInstancesByTag('Drupal 7'); + foreach ($migrations as $migration) { + try { + $process = $migration->getProcess(); + } + catch (\Exception $e) { + $this->fail(sprintf("Migration %s process failed with error: %s", $migration->label(), $e->getMessage())); + } + $this->assertNotNull($process); + } + } + +} diff --git a/core/modules/user/src/Plugin/migrate/ProfileValues.php b/core/modules/user/src/Plugin/migrate/ProfileValues.php index 8399436c033c1c91c29cc45093a2632bd479cbc6..979f873f3e55b8a6373cd179e6cd6ea1dcbf3d5c 100644 --- a/core/modules/user/src/Plugin/migrate/ProfileValues.php +++ b/core/modules/user/src/Plugin/migrate/ProfileValues.php @@ -4,7 +4,6 @@ use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\MigrateExecutable; -use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\Migration; /** @@ -32,6 +31,7 @@ public function getProcess() { $definition['destination']['plugin'] = 'null'; $definition['idMap']['plugin'] = 'null'; try { + $this->checkRequirements(); $profile_field_migration = $this->migrationPluginManager->createStubMigration($definition); $migrate_executable = new MigrateExecutable($profile_field_migration); $source_plugin = $profile_field_migration->getSourcePlugin(); @@ -45,6 +45,7 @@ public function getProcess() { [ 'migration' => 'user_profile_field', 'source_ids' => $fid, + 'no_stub' => TRUE, ]; $plugin = $this->processPluginManager->createInstance('migration_lookup', $configuration, $profile_field_migration); $new_value = $plugin->transform($fid, $migrate_executable, $row, 'tmp'); @@ -52,14 +53,12 @@ public function getProcess() { // Set the destination to the migrated profile field name. $this->process[$new_value[1]] = $name; } - else { - throw new MigrateSkipRowException("Can't migrate source field $name."); - } } } catch (RequirementsException $e) { // The checkRequirements() call will fail when the profile module does - // not exist on the source site. + // not exist on the source site, or if the required migrations have not + // yet run. } } return parent::getProcess();