You are here

protected function MultipleCartMultipleVariationTypesTest::createProductAndVariationType in Commerce Core 8.2

Same name in this branch
  1. 8.2 modules/cart/tests/src/Functional/MultipleCartMultipleVariationTypesTest.php \Drupal\Tests\commerce_cart\Functional\MultipleCartMultipleVariationTypesTest::createProductAndVariationType()
  2. 8.2 modules/cart/tests/src/FunctionalJavascript/MultipleCartMultipleVariationTypesTest.php \Drupal\Tests\commerce_cart\FunctionalJavascript\MultipleCartMultipleVariationTypesTest::createProductAndVariationType()

Creates a product and product variation type.

Parameters

string $id: The ID.

string $label: The label.

1 call to MultipleCartMultipleVariationTypesTest::createProductAndVariationType()
MultipleCartMultipleVariationTypesTest::setUp in modules/cart/tests/src/Functional/MultipleCartMultipleVariationTypesTest.php

File

modules/cart/tests/src/Functional/MultipleCartMultipleVariationTypesTest.php, line 181

Class

MultipleCartMultipleVariationTypesTest
Tests multiple cart page with different variation types.

Namespace

Drupal\Tests\commerce_cart\Functional

Code

protected function createProductAndVariationType($id, $label) {
  $variation_type = ProductVariationType::create([
    'id' => $id,
    'label' => $label,
    'orderItemType' => 'default',
    'generateTitle' => TRUE,
  ]);
  $variation_type
    ->save();
  $product_type = ProductType::create([
    'id' => $id,
    'label' => $label,
    'variationType' => $variation_type
      ->id(),
  ]);
  $product_type
    ->save();
}