You are here

public function OrderRollbackTest::testOrder in Commerce Migrate 3.1.x

Same name in this branch
  1. 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc6/OrderRollbackTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\OrderRollbackTest::testOrder()
  2. 3.1.x modules/commerce/tests/src/Kernel/Migrate/commerce1/OrderRollbackTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\OrderRollbackTest::testOrder()
Same name and namespace in other branches
  1. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc6/OrderRollbackTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\OrderRollbackTest::testOrder()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc6/OrderRollbackTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\OrderRollbackTest::testOrder()

Test rollback of order migration.

Overrides OrderTest::testOrder

File

modules/ubercart/tests/src/Kernel/Migrate/uc6/OrderRollbackTest.php, line 26

Class

OrderRollbackTest
Tests rollback of order migration.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6

Code

public function testOrder() {
  parent::testOrder();

  // Rollback orders.
  $this
    ->executeRollback('uc6_order');

  // Test that the orders no longer exist.
  $order_ids = [
    1,
    2,
  ];
  foreach ($order_ids as $order_id) {
    $order = Order::load($order_id);
    $this
      ->assertNull($order, "Order {$order_id} exists.");
  }

  // Test that the order items still exist.
  $order_item_ids = [
    2,
    3,
    4,
  ];
  foreach ($order_item_ids as $order_item_id) {
    $order_item = OrderItem::load($order_item_id);
    $this
      ->assertInstanceOf(OrderItem::class, $order_item, "Order item {$order_item_id} does not exist.");
  }
}