public function TaxTypeTest::providerSource in Commerce Migrate 8.2
Same name in this branch
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc7/TaxTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc7\TaxTypeTest::providerSource()
- 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/TaxTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\TaxTypeTest::providerSource()
- 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/TaxTypeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\TaxTypeTest::providerSource()
Same name and namespace in other branches
- 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/TaxTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\TaxTypeTest::providerSource()
- 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/TaxTypeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\TaxTypeTest::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/ TaxTypeTest.php, line 28
Class
- TaxTypeTest
- Tests Ubercart tax type source plugin.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6Code
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['uc_taxes'] = [
[
'id' => '1',
'name' => 'Handling',
'rate' => '0.05',
'shippable' => '0',
'taxed_product_types' => 'a:0:{}',
'taxed_line_items' => 'a:0:{}',
'weight' => 0,
],
[
'id' => '2',
'name' => 'Fuel',
'rate' => '0.25',
'shippable' => '0',
'taxed_product_types' => 'a:0:{}',
'taxed_line_items' => 'a:1:{s:3:"tax";s:3:"tax";}',
'weight' => 0,
],
];
$tests[0]['source_data']['variable'] = [
[
'name' => 'uc_store_country',
'value' => 's:3:"124";',
],
];
$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]['expected_data'] = [
[
'id' => '1',
'name' => 'Handling',
'rate' => '0.05',
'country_iso_code_2' => 'CA',
'shippable' => '0',
'taxed_product_types' => [],
'taxed_line_items' => [],
'weight' => 0,
],
[
'id' => '2',
'name' => 'Fuel',
'rate' => '0.25',
'country_iso_code_2' => 'CA',
'shippable' => '0',
'taxed_product_types' => [],
'taxed_line_items' => unserialize('a:1:{s:3:"tax";s:3:"tax";}'),
'weight' => 0,
],
];
return $tests;
}