You are here

public function ProductRollbackTest::testProduct in Commerce Migrate 3.1.x

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

Test product migration rollback.

Overrides ProductTest::testProduct

File

modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductRollbackTest.php, line 21

Class

ProductRollbackTest
Tests rollback of Product migration.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6

Code

public function testProduct() {
  $this
    ->executeRollback('d6_node_translation:product');
  $this
    ->executeRollback('d6_node:product');
  $product_ids = [
    1,
    2,
    3,
    6,
    7,
    8,
  ];
  foreach ($product_ids as $product_id) {
    $product = Product::load($product_id);
    $this
      ->assertNull($product, "Product {$product_id} exists.");
  }
  $product_ids = [
    4,
    5,
  ];
  foreach ($product_ids as $product_id) {
    $product = Product::load($product_id);
    $this
      ->assertInstanceOf(Product::class, $product, "Product {$product_id} does not exist.");
  }
  $product_variation_ids = [
    1,
    2,
    3,
    4,
    5,
  ];
  foreach ($product_variation_ids as $product_variation_id) {
    $product_variation = ProductVariation::load($product_variation_id);
    $this
      ->assertInstanceOf(ProductVariation::class, $product_variation, "Product variation {$product_variation_id} does not exist.");
  }
}