You are here

private function EventTrackerServiceTest::prohesizeOrder in Commerce Google Tag Manager 8.2

Same name and namespace in other branches
  1. 8 tests/src/Unit/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Unit\EventTrackerServiceTest::prohesizeOrder()

Prophesize a commerce order.

Parameters

array $order_items: The prohesized order items.

int $order_number: The order number.

string $store_name: The name of the store.

\Drupal\commerce_price\Price $total_price: The total price of the order.

Return value

\Prophecy\Prophecy\ObjectProphecy The prohesized order entity.

2 calls to EventTrackerServiceTest::prohesizeOrder()
EventTrackerServiceTest::testCheckoutStep in tests/src/Unit/EventTrackerServiceTest.php
@covers ::checkoutStep
EventTrackerServiceTest::testPurchase in tests/src/Unit/EventTrackerServiceTest.php
@covers ::purchase

File

tests/src/Unit/EventTrackerServiceTest.php, line 378

Class

EventTrackerServiceTest
Tests for the EventTracker service.

Namespace

Drupal\Tests\commerce_google_tag_manager\Unit

Code

private function prohesizeOrder(array $order_items, $order_number, $store_name, Price $total_price) {
  $store = $this
    ->prophesize(StoreInterface::class);
  $store
    ->getName()
    ->willReturn($store_name);
  $order = $this
    ->prophesize(OrderInterface::class);
  $order
    ->getItems()
    ->willReturn($order_items);
  $order
    ->getOrderNumber()
    ->willReturn($order_number);
  $order
    ->getStore()
    ->willReturn($store
    ->reveal());
  $order
    ->hasField('shipments')
    ->willReturn(FALSE);
  $order
    ->hasField('coupons')
    ->willReturn(FALSE);
  $order
    ->getTotalPrice()
    ->willReturn($total_price);
  $order
    ->collectAdjustments()
    ->willReturn([]);
  return $order;
}