public function MigrateSqlSourceCountCacheTest::providerSource in Drupal 9
Same name and namespace in other branches
- 10 core/modules/migrate/tests/src/Kernel/Plugin/source/MigrateSqlSourceCountCacheTest.php \Drupal\Tests\migrate\Kernel\Plugin\source\MigrateSqlSourceCountCacheTest::providerSource()
The data provider.
Return value
array Array of data sets to test, each of which is a numerically indexed array with the following elements:
- An array of source data, which can be optionally processed and set up by subclasses.
- An array of expected result rows.
- (optional) The number of result rows the plugin under test is expected to return. If this is not a numeric value, the plugin will not be counted.
- (optional) Array of configuration options for the plugin under test.
Overrides MigrateSourceTestBase::providerSource
See also
\Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource
File
- core/
modules/ migrate/ tests/ src/ Kernel/ Plugin/ source/ MigrateSqlSourceCountCacheTest.php, line 26
Class
- MigrateSqlSourceCountCacheTest
- Tests SqlBase source count caching.
Namespace
Drupal\Tests\migrate\Kernel\Plugin\sourceCode
public 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',
],
];
}