You are here

public function MigrationLookupTest::testSkipInvalid in Drupal 8

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

Tests that processing is skipped when the input value is invalid.

@dataProvider skipInvalidDataProvider

Parameters

mixed $value: An invalid value.

File

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

Class

MigrationLookupTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MigrationLookup @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testSkipInvalid($value) {
  $migration_plugin = $this
    ->prophesize(MigrationInterface::class);
  $migration_plugin_manager = $this
    ->prophesize(MigrationPluginManagerInterface::class);
  $configuration = [
    'migration' => 'foobaz',
  ];
  $migration_plugin
    ->id()
    ->willReturn(uniqid());
  $migration_plugin_manager
    ->createInstances([
    'foobaz',
  ])
    ->willReturn([
    'foobaz' => $migration_plugin
      ->reveal(),
  ]);
  $migration = MigrationLookup::create($this
    ->prepareContainer(), $configuration, '', [], $migration_plugin
    ->reveal());
  $this
    ->expectException(MigrateSkipProcessException::class);
  $migration
    ->transform($value, $this->migrateExecutable, $this->row, 'foo');
}