示例#1
0
文件: CartTest.php 项目: extcode/cart
 /**
  * @test
  */
 public function addSecondCartProductWithDifferentTaxClassToCartChangeTaxArray()
 {
     $firstCartProductPrice = 10.0;
     $firstCartProduct = new \Extcode\Cart\Domain\Model\Cart\Product('simple', 1, 0, 0, 1001, 'First Product', $firstCartProductPrice, $this->normalTaxClass, 1, false);
     $this->grossCart->addProduct($firstCartProduct);
     $secondCartProductPrice = 20.0;
     $secondCartProduct = new \Extcode\Cart\Domain\Model\Cart\Product('simple', 2, 0, 0, 1002, 'Second Product', $secondCartProductPrice, $this->reducedTaxClass, 1, false);
     $this->grossCart->addProduct($secondCartProduct);
     $cartTaxes = $this->grossCart->getTaxes();
     $this->assertSame($firstCartProductPrice - $firstCartProductPrice / (1 + $this->normalTaxClass->getCalc()), $cartTaxes[$this->normalTaxClass->getId()]);
     $this->assertSame($secondCartProductPrice - $secondCartProductPrice / (1 + $this->reducedTaxClass->getCalc()), $cartTaxes[$this->reducedTaxClass->getId()]);
 }