public function TermTranslationTest::providerSource in Drupal 10
Same name in this branch
- 10 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6\TermTranslationTest::providerSource()
- 10 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/TermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d7\TermTranslationTest::providerSource()
Same name and namespace in other branches
- 8 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6\TermTranslationTest::providerSource()
- 9 core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermTranslationTest.php \Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6\TermTranslationTest::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/ taxonomy/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ TermTranslationTest.php, line 23
Class
- TermTranslationTest
- Tests taxonomy term source plugin.
Namespace
Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['term_data'] = [
[
'tid' => 1,
'vid' => 5,
'name' => 'name value 1',
'description' => 'description value 1',
'weight' => 0,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 2,
'vid' => 6,
'name' => 'name value 2',
'description' => 'description value 2',
'weight' => 0,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 3,
'vid' => 6,
'name' => 'name value 3',
'description' => 'description value 3',
'weight' => 0,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 4,
'vid' => 5,
'name' => 'name value 4',
'description' => 'description value 4',
'weight' => 1,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 5,
'vid' => 6,
'name' => 'name value 5',
'description' => 'description value 5',
'weight' => 1,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 6,
'vid' => 6,
'name' => 'name value 6',
'description' => 'description value 6',
'weight' => 0,
'language' => NULL,
'trid' => 0,
],
[
'tid' => 10,
'vid' => 6,
'name' => 'zu - name value 2',
'description' => 'zu - description value 2',
'weight' => 0,
'language' => 'zu',
'trid' => 0,
],
];
$tests[0]['source_data']['term_hierarchy'] = [
[
'tid' => 1,
'parent' => 0,
],
[
'tid' => 2,
'parent' => 0,
],
[
'tid' => 3,
'parent' => 0,
],
[
'tid' => 4,
'parent' => 1,
],
[
'tid' => 5,
'parent' => 2,
],
[
'tid' => 6,
'parent' => 3,
],
[
'tid' => 6,
'parent' => 2,
],
[
'tid' => 10,
'parent' => 0,
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'tid' => 1,
'vid' => 5,
'name' => 'name value 1',
'description' => 'description value 1',
'weight' => 0,
'parent' => [
0,
],
'language' => NULL,
'trid' => 0,
],
[
'tid' => 10,
'vid' => 6,
'name' => 'zu - name value 2',
'description' => 'zu - description value 2',
'weight' => 0,
'parent' => [
0,
],
'language' => 'zu',
'trid' => 0,
],
[
'tid' => 2,
'vid' => 6,
'name' => 'name value 2',
'description' => 'description value 2',
'weight' => 0,
'parent' => [
0,
],
'language' => NULL,
'trid' => 0,
],
[
'tid' => 3,
'vid' => 6,
'name' => 'name value 3',
'description' => 'description value 3',
'weight' => 0,
'parent' => [
0,
],
'language' => NULL,
'trid' => 0,
],
[
'tid' => 4,
'vid' => 5,
'name' => 'name value 4',
'description' => 'description value 4',
'weight' => 1,
'parent' => [
1,
],
'language' => NULL,
'trid' => 0,
],
[
'tid' => 5,
'vid' => 6,
'name' => 'name value 5',
'description' => 'description value 5',
'weight' => 1,
'parent' => [
2,
],
'language' => NULL,
'trid' => 0,
],
[
'tid' => 6,
'vid' => 6,
'name' => 'name value 6',
'description' => 'description value 6',
'weight' => 0,
'parent' => [
3,
2,
],
'language' => NULL,
'trid' => 0,
],
];
$tests[0]['expected_count'] = NULL;
return $tests;
}