function StaticMapTest::testWithNullSourceWithEmptyStringMapping

Same name and namespace in other branches
  1. 11.x core/modules/migrate/tests/src/Unit/process/StaticMapTest.php \Drupal\Tests\migrate\Unit\process\StaticMapTest::testWithNullSourceWithEmptyStringMapping()

Tests when the source is invalid but there's a mapping via an empty string.

File

core/modules/migrate/tests/src/Unit/process/StaticMapTest.php, line 108

Class

StaticMapTest
Tests the static map process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testWithNullSourceWithEmptyStringMapping() : void {
  $configuration['map']['foo']['bar'] = 'baz';
  $configuration['map'][''] = 'mapped NULL';
  $this->plugin = new StaticMap($configuration, 'map', []);
  $this->expectException(MigrateSkipRowException::class);
  $this->expectExceptionMessage("No static mapping possible for NULL and no default value provided for destination 'destination_property'");
  $this->plugin
    ->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.