You are here

public function ExtractTest::providerExtractDefault in Drupal 9

Data provider for testExtractDefault.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Unit\process

Code

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