public function ProfileTest::providerSource in Commerce Migrate 3.0.x
Same name in this branch
- 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/ProfileTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProfileTest::providerSource()
- 3.0.x modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ProfileTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ProfileTest::providerSource()
Same name and namespace in other branches
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/ProfileTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProfileTest::providerSource()
- 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/ProfileTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ProfileTest::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/ ProfileTest.php, line 23
Class
- ProfileTest
- Tests the Ubercart 6 billing profile source plugin.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6Code
public function providerSource() {
$tests = [];
$tests[0]['source_data']['uc_orders'] = [
[
'order_id' => '1',
'uid' => '2',
'order_status' => 'payment_received',
'order_total' => '22.99000',
'product_count' => '2',
'primary_email' => 'f.bar@example.com',
'delivery_first_name' => 'Wile E.',
'delivery_last_name' => 'Coyote',
'delivery_phone' => '',
'delivery_company' => '',
'delivery_street1' => '',
'delivery_street2' => '',
'delivery_city' => '',
'delivery_zone' => '',
'delivery_postal_code' => '',
'delivery_country' => '',
'billing_first_name' => 'Wile E.',
'billing_last_name' => 'Coyote',
'billing_phone' => '123-4567',
'billing_company' => 'Acme',
'billing_street1' => '1 Coyote Way',
'billing_street2' => 'Utah',
'billing_city' => 'Salt Lake',
'billing_zone' => '58',
'billing_postal_code' => '11111',
'billing_country' => '840',
'payment_method' => 'cod',
'data' => 'a:0:{}',
'created' => '1492868907',
'modified' => '1498620003',
'host' => '192.168.0.2',
'currency' => 'USD',
],
[
'order_id' => '21',
'uid' => '2',
'order_status' => 'payment_received',
'order_total' => '22.99000',
'product_count' => '2',
'primary_email' => 'f.bar@example.com',
'delivery_first_name' => 'Wile E.',
'delivery_last_name' => 'Coyote',
'delivery_phone' => '',
'delivery_company' => '',
'delivery_street1' => '',
'delivery_street2' => '',
'delivery_city' => '',
'delivery_zone' => '',
'delivery_postal_code' => '',
'delivery_country' => '',
'billing_first_name' => 'Wile E.',
'billing_last_name' => 'Coyote',
'billing_phone' => '555-4567',
'billing_company' => 'Acme',
'billing_street1' => '1 Coyote Way',
'billing_street2' => 'Utah',
'billing_city' => 'Salt Lake',
'billing_zone' => '58',
'billing_postal_code' => '11111',
'billing_country' => '840',
'payment_method' => 'cod',
'data' => 'a:1:{s:13:"complete_sale";s:9:"logged_in";}',
'created' => '1492868908',
'modified' => '1498630003',
'host' => '192.168.0.2',
'currency' => 'USD',
],
];
$tests[0]['source_data']['uc_countries'] = [
[
'country_id' => '124',
'country_name' => 'Canada',
'country_iso_code_2' => 'CA',
'country_iso_code_3' => 'CAN',
'version' => 2,
'weight' => 0,
],
[
'country_id' => '840',
'country_name' => 'United States',
'country_iso_code_2' => 'US',
'country_iso_code_3' => 'USA',
'version' => 1,
'weight' => 0,
],
];
$tests[0]['source_data']['uc_zones'] = [
[
'zone_id' => '58',
'zone_country_country_id' => '840',
'zone_code' => 'UT',
'zone_name' => 'Utah',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'order_id' => '1',
'uid' => '2',
'order_status' => 'payment_received',
'order_total' => '22.99000',
'product_count' => '2',
'primary_email' => 'f.bar@example.com',
'delivery_first_name' => 'Wile E.',
'delivery_last_name' => 'Coyote',
'delivery_phone' => '',
'delivery_company' => '',
'delivery_street1' => '',
'delivery_street2' => '',
'delivery_city' => '',
'delivery_zone' => '',
'delivery_postal_code' => '',
'delivery_country' => '',
'billing_first_name' => 'Wile E.',
'billing_last_name' => 'Coyote',
'billing_phone' => '123-4567',
'billing_company' => 'Acme',
'billing_street1' => '1 Coyote Way',
'billing_street2' => 'Utah',
'billing_city' => 'Salt Lake',
'billing_zone' => '58',
'billing_postal_code' => '11111',
'billing_country' => '840',
'payment_method' => 'cod',
'data' => [],
'created' => '1492868907',
'modified' => '1498620003',
'host' => '192.168.0.2',
'currency' => 'USD',
'zone_code' => 'UT',
'country_iso_code_2' => 'US',
'status' => '0',
'is_default' => '',
],
[
'order_id' => '21',
'uid' => '2',
'order_status' => 'payment_received',
'order_total' => '22.99000',
'product_count' => '2',
'primary_email' => 'f.bar@example.com',
'delivery_first_name' => 'Wile E.',
'delivery_last_name' => 'Coyote',
'delivery_phone' => '',
'delivery_company' => '',
'delivery_street1' => '',
'delivery_street2' => '',
'delivery_city' => '',
'delivery_zone' => '',
'delivery_postal_code' => '',
'delivery_country' => '',
'billing_first_name' => 'Wile E.',
'billing_last_name' => 'Coyote',
'billing_phone' => '555-4567',
'billing_company' => 'Acme',
'billing_street1' => '1 Coyote Way',
'billing_street2' => 'Utah',
'billing_city' => 'Salt Lake',
'billing_zone' => '58',
'billing_postal_code' => '11111',
'billing_country' => '840',
'payment_method' => 'cod',
'data' => unserialize('a:1:{s:13:"complete_sale";s:9:"logged_in";}'),
'created' => '1492868908',
'modified' => '1498630003',
'host' => '192.168.0.2',
'currency' => 'USD',
'zone_code' => 'UT',
'country_iso_code_2' => 'US',
'status' => '1',
'is_default' => '1',
],
];
return $tests;
}