function ExtractTest::providerExtractDefault

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/ExtractTest.php \Drupal\Tests\migrate\Unit\process\ExtractTest::providerExtractDefault()
  2. 11.x core/modules/migrate/tests/src/Unit/process/ExtractTest.php \Drupal\Tests\migrate\Unit\process\ExtractTest::providerExtractDefault()

Data provider for testExtractDefault.

File

core/modules/migrate/tests/src/Unit/process/ExtractTest.php, line 87

Class

ExtractTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Extract @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public static function providerExtractDefault() {
    return [
        [
            [
                'foo' => 'bar',
            ],
            [
                'index' => [
                    'foo',
                ],
                'default' => 'one',
            ],
            'bar',
        ],
        [
            [
                'foo' => 'bar',
            ],
            [
                'index' => [
                    'not_key',
                ],
                'default' => 'two',
            ],
            'two',
        ],
        [
            [
                'foo' => 'bar',
            ],
            [
                'index' => [
                    'not_key',
                ],
                'default' => NULL,
            ],
            NULL,
        ],
        [
            [
                'foo' => 'bar',
            ],
            [
                'index' => [
                    'not_key',
                ],
                'default' => TRUE,
            ],
            TRUE,
        ],
        [
            [
                'foo' => 'bar',
            ],
            [
                'index' => [
                    'not_key',
                ],
                'default' => FALSE,
            ],
            FALSE,
        ],
        [
            [
                'foo' => '',
            ],
            [
                'index' => [
                    'foo',
                ],
                'default' => NULL,
            ],
            '',
        ],
    ];
}

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