You are here

public function StaticMapTest::testMapWithInvalidSourceAndBypass in Drupal 10

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

Tests when the source is invalid and bypass is enabled.

File

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

Class

StaticMapTest
Tests the static map process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMapWithInvalidSourceAndBypass() {
  $configuration['map']['foo']['bar'] = 'baz';
  $configuration['default_value'] = 'test';
  $configuration['bypass'] = TRUE;
  $this->plugin = new StaticMap($configuration, 'map', []);
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('Setting both default_value and bypass is invalid.');
  $this->plugin
    ->transform([
    'bar',
  ], $this->migrateExecutable, $this->row, 'destination_property');
}