function MigrateSqlSourceCountCacheTest::providerSource

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/source/MigrateSqlSourceCountCacheTest.php \Drupal\Tests\migrate\Kernel\Plugin\source\MigrateSqlSourceCountCacheTest::providerSource()
  2. 11.x core/modules/migrate/tests/src/Kernel/Plugin/source/MigrateSqlSourceCountCacheTest.php \Drupal\Tests\migrate\Kernel\Plugin\source\MigrateSqlSourceCountCacheTest::providerSource()

File

core/modules/migrate/tests/src/Kernel/Plugin/source/MigrateSqlSourceCountCacheTest.php, line 28

Class

MigrateSqlSourceCountCacheTest
Tests SqlBase source count caching.

Namespace

Drupal\Tests\migrate\Kernel\Plugin\source

Code

public static function providerSource() {
    // All tests use the same source_data, expected_data, expected_count, and
    // high_water. The high water is set later to maintain the order of the
    // parameters.
    $data = [
        'source_data' => [
            'source_table' => [
                [
                    'id' => 1,
                ],
                [
                    'id' => 2,
                ],
                [
                    'id' => 3,
                ],
                [
                    'id' => 4,
                ],
            ],
        ],
        'expected_data' => [
            [
                'id' => 1,
            ],
            [
                'id' => 2,
            ],
            [
                'id' => 3,
            ],
            [
                'id' => 4,
            ],
        ],
        'expected_count' => 4,
    ];
    return [
        'uncached source count' => $data,
        'cached source count, auto-generated cache key' => $data + [
            'configuration' => [
                'cache_counts' => TRUE,
            ],
            'high_water' => NULL,
            'expected_cache_key' => 'sql_count_cache-dbed2396c230e025663091479993a206441bf1f9ae4e60ebf3b504e4a76ad471',
        ],
        'cached source count, auto-generated cache key for alternative source configuration' => $data + [
            'configuration' => [
                'cache_counts' => TRUE,
                'some_source_plugin_configuration_key' => 19920106,
            ],
            'high_water' => NULL,
            'expected_cache_key' => 'sql_count_cache-83c62856dd5afc011f32574bcdc11c595557d629e1d73045e9353df2441ec269',
        ],
        'cached source count, provided cache key' => $data + [
            'configuration' => [
                'cache_counts' => TRUE,
                'cache_key' => 'custom_cache_key_here',
            ],
            'high_water' => NULL,
            'expected_cache_key' => 'custom_cache_key_here',
        ],
    ];
}

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