function MigrationLookupTest::testSkipInvalid

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testSkipInvalid()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/MigrationLookupTest.php \Drupal\Tests\migrate\Unit\process\MigrationLookupTest::testSkipInvalid()
  3. 11.x 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 107

Class

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

Namespace

Drupal\Tests\migrate\Unit\process

Code

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

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