You are here

public function ExtractTest::multipleValueProviderSource in Drupal 9

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

Provides multiple source data for "extract" process plugin test.

File

core/modules/migrate/tests/src/Kernel/process/ExtractTest.php, line 81

Class

ExtractTest
Tests the extract process plugin.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function multipleValueProviderSource() {
  $tests = [
    [
      'source_data' => [
        'id' => '1',
        'simple_array' => [
          'alpha',
          'beta',
        ],
        'complex_array' => [
          [
            'alpha',
            'beta',
          ],
          [
            'psi',
            'omega',
          ],
        ],
      ],
      'expected_data' => [
        'first' => 'alpha',
        'second' => [
          'psi',
          'omega',
        ],
      ],
    ],
    [
      'source_data' => [
        'id' => '2',
        'simple_array' => [
          'one',
        ],
        'complex_array' => [
          0,
          1,
        ],
      ],
      'expected_data' => [
        'first' => 'one',
        'second' => 1,
      ],
    ],
  ];
  return $tests;
}