You are here

protected function InvoiceSubscriberTest::setUp in Commerce Invoice 8.2

Overrides InvoiceKernelTestBase::setUp

File

tests/src/Kernel/InvoiceSubscriberTest.php, line 44

Class

InvoiceSubscriberTest
Tests the InvoiceSubscriber.

Namespace

Drupal\Tests\commerce_invoice\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig('commerce_order');
  $this
    ->installEntitySchema('commerce_order');
  $user = $this
    ->createUser();
  $this->user = $this
    ->reloadEntity($user);
  $order_item = OrderItem::create([
    'type' => 'test',
    'quantity' => 1,
    'unit_price' => new Price('12.00', 'USD'),
  ]);
  $order_item
    ->save();
  $this->orderItem = $this
    ->reloadEntity($order_item);
  $order = Order::create([
    'type' => 'default',
    'state' => 'completed',
    'store_id' => $this->store,
    'uid' => $this->user
      ->id(),
    'order_items' => [
      $order_item,
    ],
  ]);
  $order
    ->save();
  $this->order = $this
    ->reloadEntity($order);
}