Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getTotal()
 {
     $total = $this->orderItem->getUnitPrice() + $this->adjustmentsTotal;
     if ($total < 0) {
         return 0;
     }
     return $total;
 }
Exemple #2
0
 function it_has_proper_total_after_order_item_unit_price_change(AdjustmentInterface $adjustment1, AdjustmentInterface $adjustment2, OrderItemInterface $orderItem)
 {
     $orderItem->recalculateUnitsTotal()->shouldBeCalledTimes(2);
     $adjustment1->isNeutral()->willReturn(false);
     $adjustment1->setAdjustable($this)->shouldBeCalled();
     $adjustment1->getAmount()->willReturn(100);
     $adjustment2->isNeutral()->willReturn(false);
     $adjustment2->setAdjustable($this)->shouldBeCalled();
     $adjustment2->getAmount()->willReturn(50);
     $this->addAdjustment($adjustment1);
     $this->addAdjustment($adjustment2);
     $orderItem->getUnitPrice()->willReturn(500);
     $this->getTotal()->shouldReturn(650);
 }
Exemple #3
0
 public function calculateTotal()
 {
     $this->calculateAdjustmentsTotal();
     $this->total = $this->orderItem->getUnitPrice() + $this->adjustmentsTotal;
 }