public function CommerceMigrateTestTrait::assertShippingMethod in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertShippingMethod()
- 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertShippingMethod()
Asserts a shipping method.
Parameters
array $shipping_method: An array of shipment type information.
- id: The shipment id.
- label: The label for the shipment type.
- rate_amount: An array of the rate amount and the currency code, indexed by 'rate_amount' and 'currency code'.
- store: an array of store ids that use this shipping method.
3 calls to CommerceMigrateTestTrait::assertShippingMethod()
- ShippingFlatRateTest::testShippingFlatRate in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ ShippingFlatRateTest.php - Test flat rate shipping method migration.
- ShippingFlatRateTest::testShippingFlatRate in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc6/ ShippingFlatRateTest.php - Test flat rate shipping method migration.
- ShippingFlatRateTest::testShippingFlatRate in modules/
commerce/ tests/ src/ Kernel/ Migrate/ commerce1/ ShippingFlatRateTest.php - Test flat rate shipping method migration.
File
- tests/
src/ Kernel/ CommerceMigrateTestTrait.php, line 715
Class
- CommerceMigrateTestTrait
- Helper function to test migrations.
Namespace
Drupal\Tests\commerce_migrate\KernelCode
public function assertShippingMethod(array $shipping_method) {
$shipping_method_instance = ShippingMethod::load($shipping_method['id']);
$this
->assertInstanceOf(ShippingMethod::class, $shipping_method_instance);
$plugin = $shipping_method_instance
->getPlugin();
$this
->assertSame($shipping_method['label'], $shipping_method_instance
->label());
$this
->assertSame($shipping_method['stores'], $shipping_method_instance
->getStoreIds());
$rate_amount = [
'number' => $shipping_method['rate_amount']['number'],
'currency_code' => $shipping_method['rate_amount']['currency_code'],
];
$this
->assertEquals($rate_amount, $plugin
->getConfiguration()['rate_amount']);
}