You are here

public function StaticMapTest::testMapWithInvalidSourceWithANullDefaultValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/StaticMapTest.php \Drupal\Tests\migrate\Unit\process\StaticMapTest::testMapWithInvalidSourceWithANullDefaultValue()
  2. 10 core/modules/migrate/tests/src/Unit/process/StaticMapTest.php \Drupal\Tests\migrate\Unit\process\StaticMapTest::testMapWithInvalidSourceWithANullDefaultValue()

Tests when the source is invalid but there's a default value of NULL.

File

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

Class

StaticMapTest
Tests the static map process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMapWithInvalidSourceWithANullDefaultValue() {
  $configuration['map']['foo']['bar'] = 'baz';
  $configuration['default_value'] = NULL;
  $this->plugin = new StaticMap($configuration, 'map', []);
  $value = $this->plugin
    ->transform([
    'bar',
  ], $this->migrateExecutable, $this->row, 'destination_property');
  $this
    ->assertNull($value);
}