You are here

public function HandleMultiplesTest::getDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/process/HandleMultiplesTest.php \Drupal\Tests\migrate\Kernel\process\HandleMultiplesTest::getDefinition()
  2. 10 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' => '/',
        ],
      ],
    ],
    'destination' => [
      'plugin' => 'config',
      'config_name' => 'migrate_test.settings',
    ],
  ];
}