public function ShortcutTest::providerSource in Drupal 9
Same name and namespace in other branches
- 8 core/modules/shortcut/tests/src/Kernel/Plugin/migrate/source/d7/ShortcutTest.php \Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7\ShortcutTest::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/ shortcut/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ ShortcutTest.php, line 24
Class
- ShortcutTest
- Tests D7 Shortcut source plugin.
Namespace
Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['menu_links'] = [
[
'menu_name' => 'shortcut-set-2',
'mlid' => '473',
'plid' => '0',
'link_path' => 'admin/people',
'router_path' => 'admin/people',
'link_title' => 'People',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'depth' => '1',
'customized' => '0',
'p1' => '473',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'mlid' => '473',
'menu_name' => 'shortcut-set-2',
'link_path' => 'admin/people',
'link_title' => 'People',
'weight' => '-50',
],
];
return $tests;
}