You are here

protected function PromotionCompatibilityTest::setUp in Commerce Core 8.2

Overrides OrderKernelTestBase::setUp

File

modules/promotion/tests/src/Kernel/PromotionCompatibilityTest.php, line 40

Class

PromotionCompatibilityTest
Tests promotion compatibility options.

Namespace

Drupal\Tests\commerce_promotion\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('commerce_promotion');
  $this
    ->installEntitySchema('commerce_promotion_coupon');
  $this
    ->installConfig([
    'commerce_promotion',
  ]);
  $this
    ->installSchema('commerce_promotion', [
    'commerce_promotion_usage',
  ]);
  $order_item = OrderItem::create([
    'type' => 'test',
    'quantity' => 1,
    'unit_price' => new Price('12.00', 'USD'),
  ]);
  $order_item
    ->save();
  $this->order = Order::create([
    'type' => 'default',
    'state' => 'completed',
    'mail' => 'test@example.com',
    'ip_address' => '127.0.0.1',
    'order_number' => '6',
    'store_id' => $this->store,
    'order_items' => [
      $order_item,
    ],
    'total_price' => new Price('100.00', 'USD'),
    'uid' => $this
      ->createUser()
      ->id(),
  ]);
}