function ExtractTest::providerExtractDefault

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/ExtractTest.php \Drupal\Tests\migrate\Unit\process\ExtractTest::providerExtractDefault()
  2. 10 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 <a href="/api/drupal/core%21modules%21migrate%21src%21Plugin%21migrate%21process%21Extract.php/class/Extract/11.x" title="Extracts a value from an array." class="local">\Drupal\migrate\Plugin\migrate\process\Extract</a> @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.