public function ProductTypeTest::providerSource in Commerce Migrate 8.2
Same name in this branch
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc7/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc7\ProductTypeTest::providerSource()
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductTypeTest::providerSource()
- 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProductTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProductTypeTest::providerSource()
Same name and namespace in other branches
- 3.1.x modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProductTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProductTypeTest::providerSource()
- 3.0.x modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProductTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProductTypeTest::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
- modules/
commerce/ tests/ src/ Kernel/ Plugin/ migrate/ source/ commerce1/ ProductTypeTest.php, line 25
Class
- ProductTypeTest
- Tests the Commerce 1 line item source plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1Code
public function providerSource() {
$tests = [];
$tests[0]['source_data']['commerce_product_type'] = [
[
'type' => 'product',
'name' => 'Product',
'description' => 'Basic product type',
'help' => '',
'revision' => '1',
],
[
'type' => 'bag',
'name' => 'Bag',
'description' => 'Shoulder bag',
'help' => '',
'revision' => '1',
],
];
// The source data.
$tests[0]['source_data']['field_config_instance'] = [
[
'id' => '2',
'field_id' => '2',
'field_name' => 'field_x',
'entity_type' => 'commerce_product',
'bundle' => 'bag',
'deleted' => '0',
'data' => serialize([
'display' => [
'default' => [
'settings' => [
'line_item_type' => 'product',
],
],
],
]),
],
[
'id' => '3',
'field_id' => '22',
'field_name' => 'field_y',
'entity_type' => 'commerce_product',
'bundle' => 'product',
'deleted' => '0',
'data' => serialize('no_line_item_type'),
],
[
'id' => '4',
'field_id' => '12',
'field_name' => 'field_z',
'entity_type' => 'commerce_product',
'bundle' => 'product',
'deleted' => '0',
'data' => serialize('123'),
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'type' => 'product',
'name' => 'Product',
'description' => 'Basic product type',
'help' => '',
'revision' => '1',
'line_item_type' => '',
],
[
'type' => 'bag',
'name' => 'Bag',
'description' => 'Shoulder bag',
'help' => '',
'revision' => '1',
'line_item_type' => 'product',
],
];
$tests[0]['expected_count'] = 2;
return $tests;
}