diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index 5ff495b266c..ee499b097d5 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -410,7 +410,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn */ public function getDestinationPlugin($stub_being_requested = FALSE) { if ($stub_being_requested && !empty($this->destination['no_stub'])) { - throw new MigrateSkipRowException(); + throw new MigrateSkipRowException('Stub requested but not made because no_stub configuration is set.'); } if (!isset($this->destinationPlugin)) { $this->destinationPlugin = $this->destinationPluginManager->createInstance($this->destination['plugin'], $this->destination, $this); diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php index dc2cf8a57f8..a8dddd277ac 100644 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\migrate\Kernel\Plugin; use Drupal\KernelTests\KernelTestBase; use Drupal\migrate\MigrateException; +use Drupal\migrate\MigrateSkipRowException; /** * Tests the migration plugin. @@ -115,4 +116,15 @@ class MigrationTest extends KernelTestBase { $this->assertEquals(TRUE, $migration->isTrackLastImported()); } + /** + * Tests Migration::getDestinationPlugin() + * + * @covers ::getDestinationPlugin + */ + public function testGetDestinationPlugin() { + $migration = \Drupal::service('plugin.manager.migration')->createStubMigration(['destination' => ['no_stub' => TRUE]]); + $this->setExpectedException(MigrateSkipRowException::class, "Stub requested but not made because no_stub configuration is set."); + $migration->getDestinationPlugin(TRUE); + } + }