Пример #1
0
 public function testProcessWhenItemPriceIsNegativeDiscountsAreZeroed()
 {
     $negativePrice = -1;
     $nonZeroDiscount = 123;
     $this->model->init($this->model->getWebsiteId(), $this->model->getCustomerGroupId(), $this->model->getCouponCode());
     $this->item->setDiscountCalculationPrice($negativePrice);
     $this->item->setData('calculation_price', $negativePrice);
     $this->item->setDiscountAmount($nonZeroDiscount);
     $this->item->setBaseDiscountAmount($nonZeroDiscount);
     $this->item->setDiscountPercent($nonZeroDiscount);
     $this->model->process($this->item);
     $this->assertEquals(0, $this->item->getDiscountAmount());
     $this->assertEquals(0, $this->item->getBaseDiscountAmount());
     $this->assertEquals(0, $this->item->getDiscountPercent());
 }
Пример #2
0
 /**
  * Display row total with discount including tax
  *
  * @param Item $item
  * @return string
  */
 public function displayRowTotalWithDiscountInclTax($item)
 {
     $tax = $item->getTaxAmount() ? $item->getTaxAmount() : 0;
     return $this->formatPrice($item->getRowTotal() - $item->getDiscountAmount() + $tax);
 }