You are here

protected function BundleItemOrderItemTest::setUp in Commerce Product Bundle 8

Overrides CommerceProductBundleKernelTestBase::setUp

File

tests/src/Kernel/Entity/BundleItemOrderItemTest.php, line 53

Class

BundleItemOrderItemTest
Test the Product Bundle Item entity.

Namespace

Drupal\Tests\commerce_product_bundle\Kernel\Entity

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('cpb_order_item');
  $variation = ProductVariation::create([
    'type' => 'default',
  ]);
  $variation
    ->save();
  $this->productVariation = $variation;
  $bundleItem = ProductBundleItem::create([
    'type' => 'default',
    'variations' => [
      $variation,
    ],
  ]);
  $bundleItem
    ->save();
  $this->productBundleItem = $bundleItem;
  $productBundle = ProductBundle::create([
    'type' => 'default',
    'bundle_items' => [
      $bundleItem,
    ],
  ]);
  $productBundle
    ->save();
  $this->productBundle = $productBundle;
  $this->orderItem = OrderItem::create([
    'type' => 'commerce_product_bundle_default',
  ]);
}