function MigrateSqlIdMapTest::getHighestIdDataProvider

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::getHighestIdDataProvider()
  2. 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::getHighestIdDataProvider()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::getHighestIdDataProvider()

Data provider for getHighestId().

Scenarios to test:

  • Destination ID type integer.
  • Destination ID types integer and string.

Return value

array An array of data values.

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 1095

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

public function getHighestIdDataProvider() {
    return [
        'Destination ID type integer' => [
            'dest_ids' => [
                'nid' => [
                    'type' => 'integer',
                ],
            ],
            'rows' => [
                [
                    1,
                    2,
                ],
                [
                    2,
                    1,
                ],
                [
                    4,
                    3,
                ],
                [
                    9,
                    5,
                ],
            ],
            'expected' => 5,
        ],
        'Destination ID types integer and string' => [
            'dest_ids' => [
                'nid' => [
                    'type' => 'integer',
                ],
                'vid' => [
                    'type' => 'integer',
                ],
                'language' => [
                    'type' => 'string',
                ],
            ],
            'rows' => [
                [
                    1,
                    1,
                    'en',
                    1,
                    6,
                    'en',
                ],
                [
                    1,
                    4,
                    'fr',
                    1,
                    6,
                    'fr',
                ],
                [
                    1,
                    6,
                    'de',
                    1,
                    6,
                    'de',
                ],
                [
                    2,
                    8,
                    'en',
                    2,
                    8,
                    'en',
                ],
            ],
            'expected' => 2,
        ],
    ];
}

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