function StaticMapTest::testMapWithInvalidSourceAndBypass

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/process/StaticMapTest.php \Drupal\Tests\migrate\Unit\process\StaticMapTest::testMapWithInvalidSourceAndBypass()
  2. 10 core/modules/migrate/tests/src/Unit/process/StaticMapTest.php \Drupal\Tests\migrate\Unit\process\StaticMapTest::testMapWithInvalidSourceAndBypass()
  3. 11.x 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');
}

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