public function FilterFormatTest::providerSource in Drupal 8
Same name in this branch
- 8 core/modules/filter/tests/src/Kernel/Plugin/migrate/source/d6/FilterFormatTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\source\d6\FilterFormatTest::providerSource()
- 8 core/modules/filter/tests/src/Kernel/Plugin/migrate/source/d7/FilterFormatTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\source\d7\FilterFormatTest::providerSource()
Same name and namespace in other branches
- 9 core/modules/filter/tests/src/Kernel/Plugin/migrate/source/d6/FilterFormatTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\source\d6\FilterFormatTest::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/ filter/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ FilterFormatTest.php, line 24
Class
- FilterFormatTest
- Tests D6 filter format source plugin.
Namespace
Drupal\Tests\filter\Kernel\Plugin\migrate\source\d6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['filter_formats'] = [
[
'format' => 1,
'name' => 'Filtered HTML',
'roles' => ',1,2,',
'cache' => 1,
],
[
'format' => 2,
'name' => 'Full HTML',
'roles' => '',
'cache' => 1,
],
[
'format' => 4,
'name' => 'Example Custom Format',
'roles' => '4',
'cache' => 1,
],
];
$tests[0]['source_data']['filters'] = [
[
'fid' => 1,
'format' => 1,
'module' => 'filter',
'delta' => 2,
'weight' => 0,
],
[
'fid' => 2,
'format' => 1,
'module' => 'filter',
'delta' => 0,
'weight' => 1,
],
[
'fid' => 3,
'format' => 1,
'module' => 'filter',
'delta' => 1,
'weight' => 2,
],
[
'fid' => 4,
'format' => 2,
'module' => 'filter',
'delta' => 2,
'weight' => 0,
],
[
'fid' => 5,
'format' => 2,
'module' => 'filter',
'delta' => 1,
'weight' => 1,
],
[
'fid' => 6,
'format' => 2,
'module' => 'filter',
'delta' => 3,
'weight' => 10,
],
[
'fid' => 7,
'format' => 4,
'module' => 'markdown',
'delta' => 1,
'weight' => 10,
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'format' => 1,
'name' => 'Filtered HTML',
'roles' => [
1,
2,
],
'cache' => 1,
'filters' => [
[
'module' => 'filter',
'delta' => 2,
'weight' => 0,
'settings' => [],
],
[
'module' => 'filter',
'delta' => 0,
'weight' => 1,
'settings' => [],
],
[
'module' => 'filter',
'delta' => 1,
'weight' => 2,
'settings' => [],
],
],
],
[
'format' => 2,
'name' => 'Full HTML',
'roles' => [],
'cache' => 1,
'filters' => [
[
'module' => 'filter',
'delta' => 2,
'weight' => 0,
'settings' => [],
],
[
'module' => 'filter',
'delta' => 1,
'weight' => 1,
'settings' => [],
],
[
'module' => 'filter',
'delta' => 3,
'weight' => 10,
'settings' => [],
],
],
],
[
'format' => 4,
'name' => 'Example Custom Format',
'roles' => [
4,
],
'cache' => 1,
'filters' => [
// This custom format uses a filter defined by a contrib module.
[
'module' => 'markdown',
'delta' => 1,
'weight' => 10,
'settings' => [],
],
],
],
];
return $tests;
}