You are here

private function EventTrackerServiceTest::prohesizeOrderItem 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::prohesizeOrderItem()

Prophesize a commerce order item.

Parameters

\Drupal\commerce_product\Entity\ProductVariationInterface $product_variation: The corresponding prophesized product variation.

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

string $quantity: The quantity of the order item.

Return value

\Prophecy\Prophecy\ObjectProphecy The prophesized order item.

2 calls to EventTrackerServiceTest::prohesizeOrderItem()
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 407

Class

EventTrackerServiceTest
Tests for the EventTracker service.

Namespace

Drupal\Tests\commerce_google_tag_manager\Unit

Code

private function prohesizeOrderItem(ProductVariationInterface $product_variation, Price $total_price, $quantity) {
  $order_item = $this
    ->prophesize(OrderItemInterface::class);
  $order_item
    ->getPurchasedEntity()
    ->willReturn($product_variation);
  $order_item
    ->getTotalPrice()
    ->willReturn($total_price);
  $order_item
    ->getQuantity()
    ->willReturn($quantity);
  return $order_item;
}