function SubProcessWithSkipTest::getDefinition

Same name in other branches
  1. 10 core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php \Drupal\Tests\migrate\Kernel\process\SubProcessWithSkipTest::getDefinition()

Provides the test migration definition.

Return value

array

1 call to SubProcessWithSkipTest::getDefinition()
SubProcessWithSkipTest::testSubProcessSkip in core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php
Test use of skip_on_empty within sub_process.

File

core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php, line 28

Class

SubProcessWithSkipTest
Tests process pipelines when a sub_process skips a row or process.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function getDefinition() {
    return [
        'source' => [
            'plugin' => 'embedded_data',
            'data_rows' => [
                [
                    'id' => 'skip_test',
                    'my_array_of_arrays' => [
                        [
                            'key_1' => 'foo',
                            'key_2' => 'bar',
                        ],
                        [
                            'key_1' => NULL,
                            'key_2' => 'baz',
                        ],
                    ],
                ],
            ],
            'ids' => [
                'id' => [
                    'type' => 'string',
                ],
            ],
        ],
        'process' => [
            'first' => [
                'plugin' => 'default_value',
                'default_value' => 'something outside of sub_process',
            ],
            'second' => [
                'plugin' => 'sub_process',
                'source' => 'my_array_of_arrays',
                'process' => [
                    'prop_1' => [
                        [
                            'plugin' => 'skip_on_empty',
                            'source' => 'key_1',
                        ],
                        // We put a process after skip_on_empty to better test skipping
                        // a process.
[
                            'plugin' => 'get',
                            'source' => 'key_2',
                        ],
                    ],
                    'prop_2' => 'key_2',
                ],
            ],
        ],
        'destination' => [
            'plugin' => 'config',
            'config_name' => 'migrate_test.settings',
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.