Skip to content
Snippets Groups Projects
Commit 8a7ce9da authored by catch's avatar catch
Browse files

Issue #3077322 by aleevas, quietone, RoSk0, mikelutz, Lendude: Add test for...

Issue #3077322 by aleevas, quietone, RoSk0, mikelutz, Lendude: Add test for NULL source value to test of static_map process plugin
parent 40e34c8b
Branches
Tags
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
......@@ -91,4 +91,24 @@ public function testMapWithInvalidSourceAndBypass() {
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destination_property');
}
/**
* Tests when the source is NULL.
*/
public function testWithNullSourceNotInMap() {
$this->expectException(MigrateSkipRowException::class);
$this->expectExceptionMessage("No static mapping found for 'NULL' and no default value provided for destination 'destination_property'");
$this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
}
/**
* Tests when the source is invalid but there's a default.
*/
public function testWithNullSource() {
$configuration['map']['foo']['bar'] = 'baz';
$configuration['map'][NULL] = 'mapped NULL';
$this->plugin = new StaticMap($configuration, 'map', []);
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
$this->assertSame('mapped NULL', $value);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment