Loading core/modules/migrate/src/Plugin/Migration.php +4 −0 Changes for core/modules/migrate/src/Plugin/Migration.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -405,6 +405,10 @@ protected function getProcessNormalized(array $process) { if (isset($configuration['plugin'])) { $configuration = [$configuration]; } if (!is_array($configuration)) { $migration_id = $this->getPluginId(); throw new MigrateException("Invalid process for destination '$destination' in migration '$migration_id'"); } $normalized_configurations[$destination] = $configuration; } return $normalized_configurations; Loading core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php +49 −8 Changes for core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php: 49 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -42,23 +42,64 @@ public function testGetProcessPluginsException() { } /** * Tests Migration::getDestinationPlugin() * Tests Migration::getProcessPlugins() * * @covers ::getDestinationPlugin * @param array $process * The migration process pipeline. * * @covers ::getProcessPlugins * * @dataProvider getProcessPluginsExceptionMessageProvider */ public function testGetProcessPluginsExceptionMessage() { public function testGetProcessPluginsExceptionMessage(array $process) { // Test with an invalid process pipeline. $plugin_definition = [ 'process' => [ 'dest1' => 123, ], 'id' => 'foo', 'process' => $process, ]; $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($plugin_definition); reset($process); $destination = key(($process)); $migration = \Drupal::service('plugin.manager.migration') ->createStubMigration($plugin_definition); $this->expectException(MigrateException::class); $this->expectExceptionMessage("Process configuration for 'dest1' must be an array"); $this->expectExceptionMessage("Invalid process for destination '$destination' in migration 'foo'"); $migration->getProcessPlugins(); } /** * Provides data for testing invalid process pipeline. */ public function getProcessPluginsExceptionMessageProvider() { return [ [ 'Null' => [ 'dest' => NULL, ], ], [ 'boolean' => [ 'dest' => TRUE, ], ], [ 'integer' => [ 'dest' => 2370, ], ], [ 'float' => [ 'dest' => 1.61, ], ], ]; } /** * Tests Migration::getMigrationDependencies() * Loading Loading
core/modules/migrate/src/Plugin/Migration.php +4 −0 Changes for core/modules/migrate/src/Plugin/Migration.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -405,6 +405,10 @@ protected function getProcessNormalized(array $process) { if (isset($configuration['plugin'])) { $configuration = [$configuration]; } if (!is_array($configuration)) { $migration_id = $this->getPluginId(); throw new MigrateException("Invalid process for destination '$destination' in migration '$migration_id'"); } $normalized_configurations[$destination] = $configuration; } return $normalized_configurations; Loading
core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php +49 −8 Changes for core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php: 49 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -42,23 +42,64 @@ public function testGetProcessPluginsException() { } /** * Tests Migration::getDestinationPlugin() * Tests Migration::getProcessPlugins() * * @covers ::getDestinationPlugin * @param array $process * The migration process pipeline. * * @covers ::getProcessPlugins * * @dataProvider getProcessPluginsExceptionMessageProvider */ public function testGetProcessPluginsExceptionMessage() { public function testGetProcessPluginsExceptionMessage(array $process) { // Test with an invalid process pipeline. $plugin_definition = [ 'process' => [ 'dest1' => 123, ], 'id' => 'foo', 'process' => $process, ]; $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($plugin_definition); reset($process); $destination = key(($process)); $migration = \Drupal::service('plugin.manager.migration') ->createStubMigration($plugin_definition); $this->expectException(MigrateException::class); $this->expectExceptionMessage("Process configuration for 'dest1' must be an array"); $this->expectExceptionMessage("Invalid process for destination '$destination' in migration 'foo'"); $migration->getProcessPlugins(); } /** * Provides data for testing invalid process pipeline. */ public function getProcessPluginsExceptionMessageProvider() { return [ [ 'Null' => [ 'dest' => NULL, ], ], [ 'boolean' => [ 'dest' => TRUE, ], ], [ 'integer' => [ 'dest' => 2370, ], ], [ 'float' => [ 'dest' => 1.61, ], ], ]; } /** * Tests Migration::getMigrationDependencies() * Loading