public function NodeCounterTest::providerSource in Drupal 10
Same name and namespace in other branches
- 8 core/modules/statistics/tests/src/Kernel/Plugin/migrate/source/NodeCounterTest.php \Drupal\Tests\statistics\Kernel\Plugin\migrate\source\NodeCounterTest::providerSource()
- 9 core/modules/statistics/tests/src/Kernel/Plugin/migrate/source/NodeCounterTest.php \Drupal\Tests\statistics\Kernel\Plugin\migrate\source\NodeCounterTest::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/ statistics/ tests/ src/ Kernel/ Plugin/ migrate/ source/ NodeCounterTest.php, line 24
Class
- NodeCounterTest
- Tests the node_counter source plugin.
Namespace
Drupal\Tests\statistics\Kernel\Plugin\migrate\sourceCode
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['node_counter'] = [
[
'nid' => 1,
'totalcount' => 2,
'daycount' => 0,
'timestamp' => 1421727536,
],
[
'nid' => 2,
'totalcount' => 1,
'daycount' => 0,
'timestamp' => 1471428059,
],
[
'nid' => 3,
'totalcount' => 1,
'daycount' => 0,
'timestamp' => 1471428153,
],
[
'nid' => 4,
'totalcount' => 1,
'daycount' => 1,
'timestamp' => 1478755275,
],
[
'nid' => 5,
'totalcount' => 1,
'daycount' => 1,
'timestamp' => 1478755314,
],
];
// The expected results.
$tests[0]['expected_data'] = $tests[0]['source_data']['node_counter'];
return $tests;
}