public function CommentVariablePerCommentTypeTest::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/ CommentVariablePerCommentTypeTest.php, line 36
Class
- CommentVariablePerCommentTypeTest
- Tests comment variable per comment type 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',
],
[
'type' => 'story',
],
];
$tests[0]['source_data']['variable'] = [
[
'name' => 'comment_subject_field_page',
'value' => serialize(1),
],
[
'name' => 'comment_subject_field_story',
'value' => serialize(0),
],
];
// The expected results.
// Each result will also include a label and description, but those are
// static values set by the source plugin and don't need to be asserted.
$tests[0]['expected_data'] = [
[
'comment_type' => 'comment',
],
[
'comment_type' => 'comment_no_subject',
],
];
return $tests;
}