You are here

public function CommerceMigrateTestTrait::productTest in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::productTest()
  2. 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::productTest()

Helper to test a product and its variations.

Parameters

array $product: Array of product and product variation data.

File

tests/src/Kernel/CommerceMigrateTestTrait.php, line 866

Class

CommerceMigrateTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

public function productTest(array $product) {
  $variation_ids = [];
  foreach ($product['variations'] as $variation) {
    $variation_ids[] = $variation['variation_id'];
  }
  $this
    ->assertProductEntity($product['product_id'], $product['type'], $product['uid'], $product['title'], $product['published'], $product['store_ids'], $variation_ids);
  $this
    ->productVariationTest($product);
}