public function ViewModeTest::providerSource in Drupal 9
Same name in this branch
- 9 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\ViewModeTest::providerSource()
- 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/ViewModeTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\ViewModeTest::providerSource()
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\ViewModeTest::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/ node/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ ViewModeTest.php, line 24
Class
- ViewModeTest
- Tests D6 view mode source plugin.
Namespace
Drupal\Tests\node\Kernel\Plugin\migrate\source\d6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['content_node_field_instance'] = [
[
'display_settings' => serialize([
'weight' => '31',
'parent' => '',
'label' => [
'format' => 'above',
],
'teaser' => [
'format' => 'default',
'exclude' => 0,
],
'full' => [
'format' => 'default',
'exclude' => 0,
],
4 => [
'format' => 'default',
'exclude' => 0,
],
]),
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'entity_type' => 'node',
'view_mode' => '4',
],
[
'entity_type' => 'node',
'view_mode' => 'teaser',
],
[
'entity_type' => 'node',
'view_mode' => 'full',
],
];
return $tests;
}