You are here

public function NullCoalesceTest::transformDataProvider in Drupal 8

Same name and namespace in other branches
  1. 9 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 50

Class

NullCoalesceTest
Tests the null_coalesce process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public 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,
      ],
    ],
  ];
}