You are here

protected function CartIntegrationTest::setUp in Commerce Shipping 8.2

Same name in this branch
  1. 8.2 tests/src/FunctionalJavascript/CartIntegrationTest.php \Drupal\Tests\commerce_shipping\FunctionalJavascript\CartIntegrationTest::setUp()
  2. 8.2 tests/src/Kernel/CartIntegrationTest.php \Drupal\Tests\commerce_shipping\Kernel\CartIntegrationTest::setUp()

Overrides ShippingKernelTestBase::setUp

File

tests/src/Kernel/CartIntegrationTest.php, line 45

Class

CartIntegrationTest
Tests integration with the Cart module.

Namespace

Drupal\Tests\commerce_shipping\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installCommerceCart();
  $first_variation = ProductVariation::create([
    'type' => 'default',
    'sku' => 'test-product-01',
    'title' => 'Hat',
    'price' => new Price('10', 'USD'),
    'weight' => new Weight('0', 'g'),
  ]);
  $first_variation
    ->save();
  $this->variations[] = $first_variation;
  $second_variation = ProductVariation::create([
    'type' => 'default',
    'sku' => 'test-product-02',
    'title' => 'Mug',
    'price' => new Price('10', 'USD'),
    'weight' => new Weight('0', 'g'),
  ]);
  $second_variation
    ->save();
  $this->variations[] = $second_variation;
  $this->cartProvider = $this->container
    ->get('commerce_cart.cart_provider');
  $this->cartManager = $this->container
    ->get('commerce_cart.cart_manager');
}