public function ImageStylesTest::providerSource in Drupal 9
Same name and namespace in other branches
- 8 core/modules/image/tests/src/Kernel/Plugin/migrate/source/d7/ImageStylesTest.php \Drupal\Tests\image\Kernel\Plugin\migrate\source\d7\ImageStylesTest::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/ image/ tests/ src/ Kernel/ Plugin/ migrate/ source/ d7/ ImageStylesTest.php, line 24
Class
- ImageStylesTest
- Tests the D7 ImageStyles source plugin.
Namespace
Drupal\Tests\image\Kernel\Plugin\migrate\source\d7Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['image_styles'] = [
[
'isid' => 1,
'name' => 'custom_image_style_1',
'label' => 'Custom image style 1',
],
];
$tests[0]['source_data']['image_effects'] = [
[
'ieid' => 1,
'isid' => 1,
'weight' => 1,
'name' => 'image_desaturate',
'data' => serialize([]),
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'isid' => 1,
'name' => 'custom_image_style_1',
'label' => 'Custom image style 1',
'effects' => [
[
'ieid' => 1,
'isid' => 1,
'weight' => 1,
'name' => 'image_desaturate',
'data' => [],
],
],
],
];
return $tests;
}