/** * @test */ public function getTitleWithTitleDelimiterReturnsTitleSetByConstructorWithGivenTitleDelimiter() { $titleDelimiter = ','; $this->beVariant->setTitleDelimiter($titleDelimiter); $title = $this->product->getTitle() . $titleDelimiter . $this->title; $this->assertSame($title, $this->beVariant->getCompleteTitle()); }
/** * @test */ public function getTaxReturnsZeroIfNumberIsOutOfRange() { $minNumber = 5; $maxNumber = 10; $quantity = 4; $this->product = new \Extcode\Cart\Domain\Model\Cart\Product($this->productType, $this->productId, $this->tableId, $this->contentId, $this->sku, $this->title, $this->price, $this->taxClass, $quantity); $this->product->setMinNumberInCart($minNumber); $this->product->setMaxNumberInCart($maxNumber); $this->assertSame(0.0, $this->product->getTax()); $quantity = 11; $this->product = new \Extcode\Cart\Domain\Model\Cart\Product($this->productType, $this->productId, $this->tableId, $this->contentId, $this->sku, $this->title, $this->price, $this->taxClass, $quantity); $this->product->setMinNumberInCart($minNumber); $this->product->setMaxNumberInCart($maxNumber); $this->assertSame(0.0, $this->product->getTax()); }
/** * Adds Variants of a CartProduct to Order Item * * @param \Extcode\Cart\Domain\Model\Cart\Product $product CartProduct * * @return void */ protected function addProductVariants(\Extcode\Cart\Domain\Model\Cart\Product $product) { foreach ($product->getBeVariants() as $variant) { /** * Cart Variant * @var \Extcode\Cart\Domain\Model\Cart\BeVariant $variant */ if ($variant->getBeVariants()) { $this->addVariantsOfVariant($variant, 1); } else { $this->addBeVariant($variant, 1); } } }
/** * @param \Extcode\Cart\Domain\Model\Cart\Product $newproduct * * @return void */ private function addServiceAttributes($newproduct) { if ($this->maxServiceAttr1 > $newproduct->getServiceAttribute1()) { $this->maxServiceAttr1 = $newproduct->getServiceAttribute1(); } if ($this->maxServiceAttr2 > $newproduct->getServiceAttribute2()) { $this->maxServiceAttr2 = $newproduct->getServiceAttribute2(); } if ($this->maxServiceAttr3 > $newproduct->getServiceAttribute3()) { $this->maxServiceAttr3 = $newproduct->getServiceAttribute3(); } $this->sumServiceAttr1 += $newproduct->getServiceAttribute1() * $newproduct->getQuantity(); $this->sumServiceAttr2 += $newproduct->getServiceAttribute2() * $newproduct->getQuantity(); $this->sumServiceAttr3 += $newproduct->getServiceAttribute3() * $newproduct->getQuantity(); }