You are here

public function HandleMultiplesTest::getDefinition 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::getDefinition()
  2. 9 core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php \Drupal\Tests\migrate\Kernel\process\HandleMultiplesTest::getDefinition()

Provides the test migration definition.

Return value

array

1 call to HandleMultiplesTest::getDefinition()
HandleMultiplesTest::testScalarAndMultipleValues in core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php
Tests process pipelines with scalar and multiple values handling.

File

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

Class

HandleMultiplesTest
Tests process pipelines with scalar and multiple values handling.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function getDefinition() {
  return [
    'source' => [
      'plugin' => 'embedded_data',
      'data_rows' => [],
      'ids' => [
        'id' => [
          'type' => 'string',
        ],
      ],
    ],
    'process' => [
      // Process pipeline for testing values from string to array to string.
      'first' => [
        // Expects a string and returns an array.
        [
          'plugin' => 'explode',
          'source' => 'scalar',
          'delimiter' => '/',
        ],
        // Expects an array and returns a string.
        [
          'plugin' => 'extract',
          'index' => [
            1,
          ],
        ],
        // Expects a string and returns a string.
        [
          'plugin' => 'callback',
          'callable' => 'strtoupper',
        ],
      ],
      // Process pipeline for testing values from array to string to array.
      'second' => [
        // Expects an array and returns a string.
        [
          'plugin' => 'extract',
          'source' => 'multiple',
          'index' => [
            1,
          ],
        ],
        // Expects a string and returns a string.
        [
          'plugin' => 'callback',
          'callable' => 'strtoupper',
        ],
        // Expects a string and returns an array.
        [
          'plugin' => 'explode',
          'delimiter' => '/',
        ],
      ],
      // Process pipeline for testing 'get' overriding a single.
      'get_from_single' => [
        // Returns a string.
        [
          'plugin' => 'get',
          'source' => 'scalar',
        ],
        // Ignore previous and return an array.
        [
          'plugin' => 'get',
          'source' => 'multiple',
        ],
      ],
      // Process pipeline for testing 'get' overriding an array.
      'get_from_multiple' => [
        // Returns an array.
        [
          'plugin' => 'get',
          'source' => 'multiple',
        ],
        // Ignore previous and return a string.
        [
          'plugin' => 'get',
          'source' => 'scalar',
        ],
      ],
    ],
    'destination' => [
      'plugin' => 'config',
      'config_name' => 'migrate_test.settings',
    ],
  ];
}