public function BlockTest::providerSource in Drupal 8
Same name and namespace in other branches
- 9 core/modules/block/tests/src/Kernel/Plugin/migrate/source/BlockTest.php \Drupal\Tests\block\Kernel\Plugin\migrate\source\BlockTest::providerSource()
- 10 core/modules/block/tests/src/Kernel/Plugin/migrate/source/BlockTest.php \Drupal\Tests\block\Kernel\Plugin\migrate\source\BlockTest::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
1 call to BlockTest::providerSource()
- BlockTranslationTest::providerSource in core/
modules/ block/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ BlockTranslationTest.php - The data provider.
1 method overrides BlockTest::providerSource()
- BlockTranslationTest::providerSource in core/
modules/ block/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d6/ BlockTranslationTest.php - The data provider.
File
- core/
modules/ block/ tests/ src/ Kernel/ Plugin/ migrate/ source/ BlockTest.php, line 23
Class
- BlockTest
- Tests block source plugin.
Namespace
Drupal\Tests\block\Kernel\Plugin\migrate\sourceCode
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['blocks'] = [
[
'bid' => 1,
'module' => 'block',
'delta' => '1',
'theme' => 'garland',
'status' => 1,
'weight' => 0,
'region' => 'left',
'visibility' => 0,
'pages' => '',
'title' => 'Test Title 01',
'cache' => -1,
],
[
'bid' => 2,
'module' => 'block',
'delta' => '2',
'theme' => 'garland',
'status' => 1,
'weight' => 5,
'region' => 'right',
'visibility' => 0,
'pages' => '<front>',
'title' => 'Test Title 02',
'cache' => -1,
],
];
$tests[0]['source_data']['blocks_roles'] = [
[
'module' => 'block',
'delta' => 1,
'rid' => 2,
],
[
'module' => 'block',
'delta' => 2,
'rid' => 2,
],
[
'module' => 'block',
'delta' => 2,
'rid' => 100,
],
];
$tests[0]['source_data']['role'] = [
[
'rid' => 2,
'name' => 'authenticated user',
],
];
$tests[0]['source_data']['system'] = [
[
'filename' => 'modules/system/system.module',
'name' => 'system',
'type' => 'module',
'owner' => '',
'status' => '1',
'throttle' => '0',
'bootstrap' => '0',
'schema_version' => '6055',
'weight' => '0',
'info' => 'a:0:{}',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'bid' => 1,
'module' => 'block',
'delta' => '1',
'theme' => 'garland',
'status' => 1,
'weight' => 0,
'region' => 'left',
'visibility' => 0,
'pages' => '',
'title' => 'Test Title 01',
'cache' => -1,
'roles' => [
2,
],
],
[
'bid' => 2,
'module' => 'block',
'delta' => '2',
'theme' => 'garland',
'status' => 1,
'weight' => 5,
'region' => 'right',
'visibility' => 0,
'pages' => '<front>',
'title' => 'Test Title 02',
'cache' => -1,
'roles' => [
2,
],
],
];
return $tests;
}