Issue #2959097 by Jo Fitzgerald, rakesh.gectcr, quietone, heddn: Log message if migration plugin skip the row When there is no destination found.

8.7.x
Alex Pott 2018-07-22 12:31:51 +01:00
parent bbac45a7ba
commit b2f170c55f
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 13 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}
}