public function MenuLinkLocalizedTest::providerSource in Drupal 10
Same name and namespace in other branches
- 9 core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkLocalizedTest.php \Drupal\Tests\menu_link_content\Kernel\Plugin\migrate\source\d7\MenuLinkLocalizedTest::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/ MenuLinkLocalizedTest.php, line 23
Class
- MenuLinkLocalizedTest
- Tests menu link localized translation source plugin.
Namespace
Drupal\Tests\menu_link_content\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$tests = [];
$tests[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:11:"en - 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' => 'en',
'i18n_tsid' => '2',
'skip_source_translation' => TRUE,
],
[
'menu_name' => 'menu-test-menu',
'mlid' => 131,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'fr - Google',
'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:23:"fr - Google description";}}',
'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' => '2',
'skip_source_translation' => TRUE,
],
[
'menu_name' => 'menu-test-menu',
'mlid' => 132,
'plid' => 469,
'link_path' => 'https://duckduckgo.com/',
'router_path' => '',
'link_title' => 'DuckDuckGo',
'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:21:"DuckDuckGo";}}',
'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',
'skip_source_translation' => TRUE,
],
[
'menu_name' => 'menu-test-menu',
'mlid' => 139,
'plid' => 138,
'link_path' => 'admin/modules',
'router_path' => 'admin/modules',
'link_title' => 'Test 2',
'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:9:"Test link";}}',
'module' => 'menu',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => 12,
'depth' => 2,
'customized' => 1,
'p1' => '138',
'p2' => '139',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
'language' => 'und',
'i18n_tsid' => '0',
'skip_source_translation' => TRUE,
],
];
$tests[0]['expected_results'] = [
[
'menu_name' => 'menu-test-menu',
'mlid' => 130,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'Google',
'description' => 'en - Google',
'module' => 'menu',
'hidden' => 0,
'enabled' => TRUE,
'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' => 'en',
'i18n_tsid' => '2',
'skip_source_translation' => FALSE,
],
[
'menu_name' => 'menu-test-menu',
'mlid' => 130,
'plid' => 469,
'link_path' => 'http://google.com',
'router_path' => '',
'link_title' => 'fr - Google',
'description' => 'fr - Google description',
'module' => 'menu',
'hidden' => 0,
'enabled' => TRUE,
'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' => '2',
'skip_source_translation' => TRUE,
],
];
return $tests;
}