public function CommentVariableTest::providerSource in Drupal 8
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/ comment/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ CommentVariableTest.php, line 35
Class
- CommentVariableTest
- Tests d6_comment_variable source plugin.
Namespace
Drupal\Tests\comment\Kernel\Plugin\migrate\source\d6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['node_type'] = [
[
'type' => 'page',
],
];
$tests[0]['source_data']['variable'] = [
[
'name' => 'comment_page',
'value' => serialize(1),
],
[
'name' => 'comment_default_mode_page',
'value' => serialize(1),
],
[
'name' => 'comment_default_order_page',
'value' => serialize(1),
],
[
'name' => 'comment_default_per_page_page',
'value' => serialize(50),
],
[
'name' => 'comment_controls_page',
'value' => serialize(1),
],
[
'name' => 'comment_anonymous_page',
'value' => serialize(1),
],
[
'name' => 'comment_subject_field_page',
'value' => serialize(1),
],
[
'name' => 'comment_preview_page',
'value' => serialize(1),
],
[
'name' => 'comment_form_location_page',
'value' => serialize(1),
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'comment' => '1',
'comment_default_mode' => '1',
'comment_default_order' => '1',
'comment_default_per_page' => '50',
'comment_controls' => '1',
'comment_anonymous' => '1',
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '1',
'node_type' => 'page',
'comment_type' => 'comment',
],
];
return $tests;
}