You are here

public function TransposeTest::transposeDataProvider in Migrate Plus 8.5

Data provider for testTranspose().

Return value

array An array containing input values and expected output values.

File

tests/src/Unit/process/TransposeTest.php, line 45

Class

TransposeTest
Tests the transpose process plugin.

Namespace

Drupal\Tests\migrate_plus\Unit\process

Code

public function transposeDataProvider() : array {
  return [
    'empty array' => [
      'input' => [],
      'expected_output' => [],
    ],
    'simple array' => [
      'input' => [
        1,
        2,
        3,
      ],
      'expected_output' => [
        [
          1,
          2,
          3,
        ],
      ],
    ],
    'image files and alt text' => [
      'input' => [
        [
          '2.png',
          '3.png',
          '5.png',
          '7.png',
        ],
        [
          'two',
          'three',
          'five',
          'seven',
        ],
      ],
      'expected_output' => [
        [
          '2.png',
          'two',
        ],
        [
          '3.png',
          'three',
        ],
        [
          '5.png',
          'five',
        ],
        [
          '7.png',
          'seven',
        ],
      ],
    ],
    'indexed arrays' => [
      'input' => [
        [
          'a' => 1,
          'b' => 2,
        ],
        [
          'c' => 3,
          'd' => 4,
        ],
        [
          'e' => 5,
          'f' => 6,
        ],
        [
          'g' => 7,
          'h' => 8,
        ],
      ],
      'output' => [
        [
          1,
          3,
          5,
          7,
        ],
        [
          2,
          4,
          6,
          8,
        ],
      ],
    ],
  ];
}