public function CommerceMigrateTestTrait::assertUbercartOrder in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertUbercartOrder()
- 3.1.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertUbercartOrder()
Asserts an order entity.
Parameters
array $order: An array of order information.
- id: The order id.
- type: The order type.
- number: The order number.
- store_id: The store id.
- created_time: The time the order was created.
- changed_time: The time the order was changed.
- email: The email address for this order.
- label: The label for this order.
- ip_address: The ip address used to create this order.
- customer_id: The customer id.
- placed_time: The time the order was placed.
- total_price_currency: Currency code for the total price.
- total_price: The amount of the total price.
- adjustments: An array of adjustments.
- label_value: The state label
- billing_profile: An array of billing profile target id and target
revision id.
- data: The data blob for this order.
- order_items_ids: An array of order item IDs for this order.
- order_admin_comments: An array of order admin comments.
- order_items_ids: An array of order comments.
2 calls to CommerceMigrateTestTrait::assertUbercartOrder()
- OrderTest::testOrder in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc6/ OrderTest.php - Test order migration.
- OrderTest::testUbercartOrder in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ OrderTest.php - Test order migration.
File
- tests/
src/ Kernel/ CommerceMigrateTestTrait.php, line 813
Class
- CommerceMigrateTestTrait
- Helper function to test migrations.
Namespace
Drupal\Tests\commerce_migrate\KernelCode
public function assertUbercartOrder(array $order) {
$this
->assertOrder($order);
$order_instance = Order::load($order['id']);
// Only test if the expected array has data for the following fields. These
// fields can have many entries and just gets unwieldy to create the correct
// expected data.
if (isset($order['order_admin_comments'])) {
$this
->assertSame($order['order_admin_comments'], $order_instance
->get('field_order_admin_comments')
->getValue());
}
if (isset($order['order_comments'])) {
$this
->assertSame($order['order_comments'], $order_instance
->get('field_order_comments')
->getValue());
}
if (isset($order['order_logs'])) {
$this
->assertSame($order['order_logs'], $order_instance
->get('field_order_logs')
->getValue());
}
}