public function ColorTest::providerSource in Drupal 8
Same name and namespace in other branches
- 9 core/modules/color/tests/src/Kernel/Plugin/migrate/source/d7/ColorTest.php \Drupal\Tests\color\Kernel\Plugin\migrate\source\d7\ColorTest::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/ color/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ ColorTest.php, line 24
Class
- ColorTest
- Tests D7 color source plugin.
Namespace
Drupal\Tests\color\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['database']['variable'] = [
[
'name' => 'color_bartik_palette',
'value' => [
'top' => '#cd2d2d',
'bottom' => '#d64e4e',
'bg' => '#ffffff',
'sidebar' => '#f1f4f0',
'sidebarborders' => '#ededed',
'footer' => '#1f1d1c',
'titleslogan' => '#fffeff',
'text' => '#888888',
'link' => '#d6121f',
],
],
[
'name' => 'color_bartik_logo',
'value' => 'public://color/bartik-e0e23ad7/logo.png',
],
[
'name' => 'color_bartik_stylesheets',
'value' => [
'public://color/bartik-1d249313/colors.css',
],
],
[
'name' => 'color_bartik_files',
'value' => [
'public://color/bartik-e0e23ad7/logo.png',
'public://color/bartik-e0e23ad7/colors.css',
],
],
[
'name' => 'color_bartik_screenshot',
'value' => [
'public:://color/bartik-b69cfcec/screenshot.png',
],
],
[
'name' => 'color_custom_stylesheets',
'value' => [
'public:://color/custom-beadedff/colors.css',
],
],
];
foreach ($tests[0]['database']['variable'] as $key => $expected) {
$tests[0]['database']['variable'][$key]['value'] = serialize($expected['value']);
}
$tests[0]['database']['system'] = [
[
'name' => 'bartik',
'type' => 'theme',
'status' => '1',
],
[
'name' => 'custom',
'type' => 'theme',
'status' => '0',
],
];
// Expected results are the same as the source.
$tests[0]['expected_results'] = [
[
'name' => 'color_bartik_palette',
'value' => [
'top' => '#cd2d2d',
'bottom' => '#d64e4e',
'bg' => '#ffffff',
'sidebar' => '#f1f4f0',
'sidebarborders' => '#ededed',
'footer' => '#1f1d1c',
'titleslogan' => '#fffeff',
'text' => '#888888',
'link' => '#d6121f',
],
],
[
'name' => 'color_bartik_logo',
'value' => 'public://color/bartik-e0e23ad7/logo.png',
],
[
'name' => 'color_bartik_stylesheets',
'value' => [
'public://color/bartik-1d249313/colors.css',
],
],
[
'name' => 'color_bartik_files',
'value' => [
'public://color/bartik-e0e23ad7/logo.png',
'public://color/bartik-e0e23ad7/colors.css',
],
],
[
'name' => 'color_bartik_screenshot',
'value' => [
'public:://color/bartik-b69cfcec/screenshot.png',
],
],
[
'name' => 'color_custom_stylesheets',
'value' => [
'public:://color/custom-beadedff/colors.css',
],
],
];
return $tests;
}