ProductRollbackTest.php in Commerce Migrate 3.1.x
File
modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductRollbackTest.php
View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6;
use Drupal\commerce_product\Entity\ProductVariation;
use Drupal\commerce_product\Entity\Product;
class ProductRollbackTest extends ProductTest {
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.");
}
}
}