public function ProductVariationTest::providerSource in Commerce Migrate 8.2
Same name in this branch
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc7/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc7\ProductVariationTest::providerSource()
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductVariationTest::providerSource()
- 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProductVariationTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProductVariationTest::providerSource()
Same name and namespace in other branches
- 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductVariationTest::providerSource()
- 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProductVariationTest::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/
ubercart/ tests/ src/ Kernel/ Plugin/ migrate/ source/ uc6/ ProductVariationTest.php, line 28
Class
- ProductVariationTest
- Tests the Ubercart product variation source plugin.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6Code
public function providerSource() {
$tests = [];
$tests[0]['source_data']['node'] = [
[
'nid' => 1,
'vid' => 1,
'type' => 'page',
'language' => 'en',
'title' => 'node title 1',
'uid' => 1,
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'translate' => 0,
'tnid' => 0,
],
[
'nid' => 2,
'vid' => 2,
'type' => 'ship',
'language' => 'en',
'title' => 'ship 1',
'uid' => 1,
'status' => 1,
'created' => 1279290900,
'changed' => 1279308000,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'translate' => 0,
'tnid' => 0,
],
[
'nid' => 3,
'vid' => 3,
'type' => 'product',
'language' => 'en',
'title' => 'product 1',
'uid' => 1,
'status' => 1,
'created' => 1279290908,
'changed' => 1279308993,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'translate' => 0,
'tnid' => 0,
],
];
$tests[0]['source_data']['node_revisions'] = [
[
'nid' => 1,
'vid' => 1,
'uid' => 1,
'title' => 'node title 1',
'body' => 'body for node 1',
'teaser' => 'teaser for node 1',
'log' => '',
'format' => 1,
'timestamp' => 1279051598,
],
[
'nid' => 2,
'vid' => 2,
'uid' => 1,
'title' => 'ship 1',
'body' => 'body for node 2',
'teaser' => 'teaser for node 2',
'log' => '',
'format' => 1,
'timestamp' => 1279308993,
],
[
'nid' => 3,
'vid' => 3,
'uid' => 1,
'title' => 'product 1',
'body' => 'body for node 3',
'teaser' => 'teaser for node 3',
'log' => '',
'format' => 1,
'timestamp' => 1279308993,
],
];
$tests[0]['source_data']['uc_products'] = [
[
'vid' => '2',
'nid' => '2',
'model' => 'Heart of Gold',
'list_price' => '25.0000',
'cost' => '10.0000',
'sell_price' => '900.0000',
'weight' => '10',
'weight_units' => 'g',
'length' => '20',
'width' => '10',
'height' => '50',
'length_units' => 'cm',
'pkg_qty' => '1',
'default_qty' => '1',
'unique_hash' => 'a',
'ordering' => '0',
'shippable' => '1',
],
[
'vid' => '3',
'nid' => '3',
'model' => 'book',
'list_price' => '25.0000',
'cost' => '10.0000',
'sell_price' => '20.0000',
'weight' => '10',
'weight_units' => 'g',
'length' => '20',
'width' => '10',
'height' => '50',
'length_units' => 'cm',
'pkg_qty' => '1',
'default_qty' => '1',
'unique_hash' => 'a',
'ordering' => '0',
'shippable' => '1',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'nid' => 2,
'vid' => 2,
'language' => 'en',
'status' => '1',
'created' => '1279290900',
'changed' => '1279308000',
'comment' => '0',
'promote' => '1',
'moderate' => '0',
'sticky' => '0',
'tnid' => '2',
'translate' => '0',
'title' => 'ship 1',
'body' => 'body for node 2',
'teaser' => 'teaser for node 2',
'log' => '',
'timestamp' => '1279308993',
'format' => '1',
'node_uid' => '1',
'revision_uid' => '1',
'model' => 'Heart of Gold',
'sell_price' => '900.0000',
'type' => 'ship',
],
[
'nid' => 3,
'vid' => 3,
'language' => 'en',
'status' => '1',
'created' => '1279290908',
'changed' => '1279308993',
'comment' => '0',
'promote' => '1',
'moderate' => '0',
'sticky' => '0',
'tnid' => '3',
'translate' => '0',
'title' => 'product 1',
'body' => 'body for node 3',
'teaser' => 'teaser for node 3',
'log' => '',
'timestamp' => '1279308993',
'format' => '1',
'node_uid' => '1',
'revision_uid' => '1',
'model' => 'book',
'sell_price' => '20.0000',
'type' => 'product',
],
];
$tests[0]['expected_count'] = 2;
// The expected results.
$tests[1]['source_data'] = $tests[0]['source_data'];
$tests[1]['expected_data'] = [
[
'nid' => 2,
'vid' => 2,
'language' => 'en',
'status' => '1',
'created' => '1279290900',
'changed' => '1279308000',
'comment' => '0',
'promote' => '1',
'moderate' => '0',
'sticky' => '0',
'tnid' => '2',
'translate' => '0',
'title' => 'ship 1',
'body' => 'body for node 2',
'teaser' => 'teaser for node 2',
'log' => '',
'timestamp' => '1279308993',
'format' => '1',
'node_uid' => '1',
'revision_uid' => '1',
'model' => 'Heart of Gold',
'sell_price' => '900.0000',
'type' => 'ship',
],
];
$tests[1]['expected_count'] = 1;
$tests[1]['configuration']['node_type'] = 'ship';
return $tests;
}