You are here

public function HandleMultiplesTest::testScalarAndMultipleValues in Drupal 10

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

Tests process pipelines with scalar and multiple values handling.

@dataProvider scalarAndMultipleValuesProviderSource

Parameters

array $source_data: The source data.

array $expected_data: The expected results.

File

core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php, line 118

Class

HandleMultiplesTest
Tests process pipelines with scalar and multiple values handling.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function testScalarAndMultipleValues(array $source_data, array $expected_data) {
  $definition = $this
    ->getDefinition();
  $definition['source']['data_rows'] = [
    $source_data,
  ];
  $migration = \Drupal::service('plugin.manager.migration')
    ->createStubMigration($definition);
  $executable = new MigrateExecutable($migration);
  $result = $executable
    ->import();

  // Migration needs to succeed before further assertions are made.
  $this
    ->assertSame(MigrationInterface::RESULT_COMPLETED, $result);

  // Compare with expected data.
  $this
    ->assertEquals($expected_data, \Drupal::config('migrate_test.settings')
    ->get());
}