Example #1
0
 /**
  * @test
  */
 public function getCouponTaxReturnsAllCouponsTaxSum()
 {
     $gross = 10.0;
     $tax = $gross - $gross / ($this->normalTaxClass->getCalc() + 1);
     $firstCoupon = $this->getMock(\Extcode\Cart\Domain\Model\Cart\CartCoupon::class, [], array(), '', false, true, true, array('getCode', 'getTax', 'getTaxClass', 'getIsUseable', 'getIsCombinable'));
     $firstCoupon->expects($this->any())->method('getCode')->will($this->returnValue('firstCouponCode'));
     $firstCoupon->expects($this->any())->method('getTax')->will($this->returnValue($tax));
     $firstCoupon->expects($this->any())->method('getTaxClass')->will($this->returnValue($this->normalTaxClass));
     $firstCoupon->expects($this->any())->method('getIsUseable')->will($this->returnValue(true));
     $firstCoupon->expects($this->any())->method('getIsCombinable')->will($this->returnValue(true));
     $this->grossCart->addCoupon($firstCoupon);
     $taxes = [];
     $taxes[$this->normalTaxClass->getId()] += $tax;
     $this->assertArraySubset($taxes, $this->grossCart->getCouponTaxes());
     $this->netCart->addCoupon($firstCoupon);
     $this->assertArraySubset($taxes, $this->netCart->getCouponTaxes());
 }
Example #2
0
 /**
  * @test
  */
 public function getIdReturnsIdSetByConstructor()
 {
     $this->assertSame($this->id, $this->fixture->getId());
 }
Example #3
0
 /**
  * @param float $tax
  * @param \Extcode\Cart\Domain\Model\Cart\TaxClass $taxClass
  *
  * @return void
  */
 public function subTax($tax, $taxClass)
 {
     $this->taxes[$taxClass->getId()] -= $tax;
 }
Example #4
0
 /**
  * @return array
  */
 public function getTax()
 {
     $this->calcTax();
     return ['taxclassid' => $this->taxClass->getId(), 'tax' => $this->tax];
 }