You are here

protected function OrderProductCategoryTest::buildOrder in Commerce Core 8.2

Builds a mock order with the given order items.

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface[] $order_items: The order items.

Return value

object The mock order.

1 call to OrderProductCategoryTest::buildOrder()
OrderProductCategoryTest::testEvaluate in modules/product/tests/src/Unit/Plugin/Commerce/Condition/OrderProductCategoryTest.php
::covers evaluate.

File

modules/product/tests/src/Unit/Plugin/Commerce/Condition/OrderProductCategoryTest.php, line 113

Class

OrderProductCategoryTest
@coversDefaultClass \Drupal\commerce_product\Plugin\Commerce\Condition\OrderProductCategory @group commerce

Namespace

Drupal\Tests\commerce_product\Unit\Plugin\Commerce\Condition

Code

protected function buildOrder(array $order_items) {
  $order = $this
    ->prophesize(OrderInterface::class);
  $order
    ->getEntityTypeId()
    ->willReturn('commerce_order');
  $order
    ->getItems()
    ->wilLReturn($order_items);
  $order = $order
    ->reveal();
  return $order;
}