public function OrderItemDeriverTest::testOrderItemMigration in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/commerce/tests/src/Kernel/Migrate/commerce1/OrderItemDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\OrderItemDeriverTest::testOrderItemMigration()
- 3.1.x modules/commerce/tests/src/Kernel/Migrate/commerce1/OrderItemDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\OrderItemDeriverTest::testOrderItemMigration()
Test product variation migrations with commerce_product enabled.
File
- modules/
commerce/ tests/ src/ Kernel/ Migrate/ commerce1/ OrderItemDeriverTest.php, line 40
Class
- OrderItemDeriverTest
- Test Order item deriver.
Namespace
Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1Code
public function testOrderItemMigration() {
// Create the order item derivatives.
$migrations = $this->pluginManager
->createInstances([
'commerce1_order_item',
]);
// Test that the line item for product exists.
$this
->assertArrayHasKey('commerce1_order_item:product', $migrations, "Commerce product migrations exist after commerce_product installed");
// Test that the product line item price fields exist in the migration.
/** @var \Drupal\migrate\Plugin\migration $migration */
$migration = $migrations['commerce1_order_item:product'];
$process = $migration
->getProcess();
$this
->assertArrayHasKey('unit_price', $process, "Commerce order does not have a unit price field.");
$this
->assertArrayHasKey('total_price', $process, "Commerce order does not have a total price field.");
// Test that the line item for shipping does not exist.
$this
->assertArrayNotHasKey('commerce1_order_item:shipping', $migrations, "Commerce product migrations exist after commerce_product installed");
}