Commit 8a7ce9da authored by catch's avatar catch

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
......@@ -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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment