function MigrationTest::testSuccessfulLookup
Tests a successful lookup.
@dataProvider successfulLookupDataProvider
@expectedDeprecation Not passing the migrate lookup service as the fifth parameter to Drupal\migrate\Plugin\migrate\process\MigrationLookup::__construct is deprecated in drupal:8.8.0 and will throw a type error in drupal:9.0.0. Pass an instance of \Drupal\migrate\MigrateLookupInterface. See https://www.drupal.org/node/3047268 @expectedDeprecation Not passing the migrate stub service as the sixth parameter to Drupal\migrate\Plugin\migrate\process\MigrationLookup::__construct is deprecated in drupal:8.8.0 and will throw a type error in drupal:9.0.0. Pass an instance of \Drupal\migrate\MigrateStubInterface. See https://www.drupal.org/node/3047268
Parameters
array $source_id_values: The source id(s) of the migration map.
array $destination_id_values: The destination id(s) of the migration map.
string|array $source_value: The source value(s) for the migration process plugin.
string|array $expected_value: The expected value(s) of the migration process plugin.
Throws
\Drupal\migrate\MigrateSkipProcessException
File
-
core/
modules/ migrate/ tests/ src/ Unit/ process/ MigrationTest.php, line 142
Class
- MigrationTest
- @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Migration @group migrate @group legacy
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testSuccessfulLookup(array $source_id_values, array $destination_id_values, $source_value, $expected_value) {
$configuration = [
'migration' => 'foobaz',
];
$this->migrateLookup
->lookup('foobaz', $source_id_values)
->willReturn([
$destination_id_values,
]);
$this->prepareContainer();
$migration = new Migration($configuration, 'migration', [], $this->migration_plugin
->reveal(), $this->migration_plugin_manager
->reveal(), $this->process_plugin_manager
->reveal());
$this->assertSame($expected_value, $migration->transform($source_value, $this->migrateExecutable, $this->row, 'foo'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.