Skip to content
Snippets Groups Projects
Unverified Commit 522631b0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2951715 by dravenk, marvil07, rakesh.gectcr, davidsonjames, heddn, Jo...

Issue #2951715 by dravenk, marvil07, rakesh.gectcr, davidsonjames, heddn, Jo Fitzgerald, quietone, alexpott, maxocub: Log message if static_map plugin skips the row
parent 68cd2e55
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Drupal\migrate\Plugin\migrate\process; namespace Drupal\migrate\Plugin\migrate\process;
use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\Variable;
use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\MigrateExecutableInterface;
...@@ -140,7 +141,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable ...@@ -140,7 +141,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
return $this->configuration['default_value']; return $this->configuration['default_value'];
} }
if (empty($this->configuration['bypass'])) { if (empty($this->configuration['bypass'])) {
throw new MigrateSkipRowException(); throw new MigrateSkipRowException(sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export($value), $destination_property));
} }
else { else {
return $value; return $value;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\Tests\migrate\Unit\process; namespace Drupal\Tests\migrate\Unit\process;
use Drupal\Component\Utility\Variable;
use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateException;
use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\StaticMap; use Drupal\migrate\Plugin\migrate\process\StaticMap;
...@@ -50,7 +51,7 @@ public function testMapwithEmptySource() { ...@@ -50,7 +51,7 @@ public function testMapwithEmptySource() {
* Tests when the source is invalid. * Tests when the source is invalid.
*/ */
public function testMapwithInvalidSource() { public function testMapwithInvalidSource() {
$this->setExpectedException(MigrateSkipRowException::class); $this->setExpectedException(MigrateSkipRowException::class, sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export(['bar']), 'destinationproperty'));
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty'); $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment