function NullCoalesceTest::transformDataProvider

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::transformDataProvider()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::transformDataProvider()
  3. 10 core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::transformDataProvider()

Provides Data for ::testTransform.

File

core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php, line 52

Class

NullCoalesceTest
Tests the null_coalesce process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public static function transformDataProvider() {
    return [
        'all null' => [
            'source' => [
                NULL,
                NULL,
                NULL,
            ],
            'expected_result' => NULL,
        ],
        'false first' => [
            'source' => [
                FALSE,
                NULL,
                NULL,
            ],
            'expected_result' => FALSE,
        ],
        'no null' => [
            'source' => [
                'test',
                'test2',
            ],
            'expected_result' => 'test',
        ],
        'string first' => [
            'source' => [
                'test',
                NULL,
                'test2',
            ],
            'expected_result' => 'test',
        ],
        'empty string' => [
            'source' => [
                NULL,
                '',
                NULL,
            ],
            'expected_result' => '',
        ],
        'array' => [
            'source' => [
                NULL,
                NULL,
                [
                    1,
                    2,
                    3,
                ],
            ],
            'expected_result' => [
                1,
                2,
                3,
            ],
        ],
    ];
}

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