summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathaniel Catchpole2019-01-07 11:40:36 (GMT)
committerNathaniel Catchpole2019-01-07 11:41:01 (GMT)
commit305fd923942dd0ae267e00bb2da596b54f4ada44 (patch)
tree12eb7fff95303dc421fc5595ecc87b3b5c0080c7 /core
parent8f75b2aaccb756b0a8d1025cf5ce128cd039990d (diff)
Issue #3023747 by mikelutz, heddn: D6 profile migrations assume stubs, which fail
(cherry picked from commit 95b3b17867f3691951e4fa2bc4bb0b7c21431fba)
Diffstat (limited to 'core')
-rw-r--r--core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php43
-rw-r--r--core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php43
-rw-r--r--core/modules/user/src/Plugin/migrate/ProfileValues.php9
3 files changed, 90 insertions, 5 deletions
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 0000000..4292769
--- /dev/null
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrationProcessTest.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\Tests\migrate_drupal\Kernel\d6;
+
+use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
+
+/**
+ * Tests the getProcess() method of all Drupal 6 migrations.
+ *
+ * @group migrate_drupal
+ */
+class MigrationProcessTest extends MigrateDrupal6TestBase {
+ use FileSystemModuleDiscoveryDataProviderTrait;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ self::$modules = array_keys($this->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 0000000..4f3826f
--- /dev/null
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrationProcessTest.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\Tests\migrate_drupal\Kernel\d7;
+
+use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
+
+/**
+ * Tests the getProcess() method of all Drupal 7 migrations.
+ *
+ * @group migrate_drupal
+ */
+class MigrationProcessTest extends MigrateDrupal7TestBase {
+ use FileSystemModuleDiscoveryDataProviderTrait;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ self::$modules = array_keys($this->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 8399436..979f873 100644
--- a/core/modules/user/src/Plugin/migrate/ProfileValues.php
+++ b/core/modules/user/src/Plugin/migrate/ProfileValues.php
@@ -4,7 +4,6 @@ namespace Drupal\user\Plugin\migrate;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\MigrateExecutable;
-use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\Migration;
/**
@@ -32,6 +31,7 @@ class ProfileValues extends Migration {
$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 @@ class ProfileValues extends Migration {
[
'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 @@ class ProfileValues extends Migration {
// 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();