public function MenuLinkTranslationTest::providerSource in Drupal 9
Same name in this branch
- 9 core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php \Drupal\Tests\menu_link_content\Kernel\Plugin\migrate\source\d6\MenuLinkTranslationTest::providerSource()
- 9 core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkTranslationTest.php \Drupal\Tests\menu_link_content\Kernel\Plugin\migrate\source\d7\MenuLinkTranslationTest::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/ menu_link_content/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ MenuLinkTranslationTest.php, line 23
Class
- MenuLinkTranslationTest
- Tests menu link localized translation source plugin.
Namespace
Drupal\Tests\menu_link_content\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$test = [];
$test[0]['source_data']['menu_links'] = [
[
'menu_name' => 'menu-test-menu',
'mlid' => 130,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'Google',
'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}',
'module' => 'menu',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => 0,
'depth' => 2,
'customized' => 1,
'p1' => '469',
'p2' => '467',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
'language' => 'und',
'i18n_tsid' => '0',
'ml_language' => 'und',
'lid' => '1',
'property' => 'title',
'lt_language' => 'fr',
'translation' => 'fr - title translation',
'title_translated' => 'fr - title translation',
'description_translated' => 'fr - description translation',
],
];
$test[0]['source_data']['i18n_string'] = [
[
'lid' => 1,
'textgroup' => 'menu',
'context' => 'item:130:title',
'objectid' => 130,
'type' => 'item',
'property' => 'title',
'objectindex' => 130,
'format' => 0,
],
[
'lid' => 2,
'textgroup' => 'menu',
'context' => 'item:130:description',
'objectid' => 130,
'type' => 'item',
'property' => 'description',
'objectindex' => 130,
'format' => 0,
],
];
$test[0]['source_data']['locales_target'] = [
[
'lid' => 1,
'language' => 'fr',
'translation' => 'fr - title translation',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
[
'lid' => 2,
'language' => 'fr',
'translation' => 'fr - description translation',
'plid' => 0,
'plural' => 0,
'i18n_status' => 0,
],
];
$test[0]['expected_results'] = [
[
'menu_name' => 'menu-test-menu',
'mlid' => 130,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'Google',
'module' => 'menu',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => 0,
'depth' => 2,
'customized' => 1,
'p1' => '469',
'p2' => '467',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
'language' => 'fr',
'i18n_tsid' => '0',
'parent_link_path' => NULL,
'property' => 'title',
'lid' => '1',
'lt_language' => 'fr',
'translation' => 'fr - title translation',
'description_translated' => 'fr - description translation',
'title_translated' => 'fr - title translation',
],
[
'menu_name' => 'menu-test-menu',
'mlid' => 130,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'Google',
'module' => 'menu',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => 0,
'depth' => 2,
'customized' => 1,
'p1' => '469',
'p2' => '467',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
'language' => 'fr',
'i18n_tsid' => '0',
'parent_link_path' => NULL,
'property' => 'description',
'lid' => '2',
'lt_language' => 'fr',
'translation' => 'fr - description translation',
'description_translated' => 'fr - description translation',
'title_translated' => 'fr - title translation',
],
];
return $test;
}