You are here

protected function CheckoutAccessTest::setUp in Commerce Core 8.2

Overrides CartKernelTestBase::setUp

File

modules/checkout/tests/src/Kernel/CheckoutAccessTest.php, line 65

Class

CheckoutAccessTest
Tests the checkout access for orders.

Namespace

Drupal\Tests\commerce_checkout\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig('commerce_checkout');
  $this
    ->createUser();
  $this->accessManager = $this->container
    ->get('access_manager');
  $this->orderItemStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('commerce_order_item');
  $variation = ProductVariation::create([
    'type' => 'default',
    'sku' => $this
      ->randomMachineName(),
    'price' => [
      'number' => 999,
      'currency_code' => 'USD',
    ],
  ]);
  $variation
    ->save();
  $product = Product::create([
    'type' => 'default',
    'title' => $this
      ->randomMachineName(),
    'stores' => [
      $this->store,
    ],
    'variations' => [
      $this->variation,
    ],
  ]);
  $product
    ->save();
  $this->variation = $this
    ->reloadEntity($variation);
  $this->store = $this
    ->createStore();
}