You are here

public function StaticMapTest::testMapWithInvalidSourceWithADefaultValue in Zircon Profile 8

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

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

File

core/modules/migrate/tests/src/Unit/process/StaticMapTest.php, line 64
Contains \Drupal\Tests\migrate\Unit\process\StaticMapTest.

Class

StaticMapTest
Tests the static map process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMapWithInvalidSourceWithADefaultValue() {
  $configuration['map']['foo']['bar'] = 'baz';
  $configuration['default_value'] = 'test';
  $this->plugin = new StaticMap($configuration, 'map', array());
  $value = $this->plugin
    ->transform(array(
    'bar',
  ), $this->migrateExecutable, $this->row, 'destinationproperty');
  $this
    ->assertSame($value, 'test');
}