function it_should_remove_tax_adjustments(AdjustmentInterface $shippingAdjustment, AdjustmentInterface $taxAdjustment) { $shippingAdjustment->getLabel()->willReturn(AdjustmentInterface::SHIPPING_ADJUSTMENT); $shippingAdjustment->setAdjustable($this)->shouldBeCalled(); $taxAdjustment->getLabel()->willReturn(AdjustmentInterface::TAX_ADJUSTMENT); $taxAdjustment->setAdjustable($this)->shouldBeCalled(); $this->addAdjustment($shippingAdjustment); $this->addAdjustment($taxAdjustment); $this->getAdjustments()->count()->shouldReturn(2); //both adjustments have been added $taxAdjustment->isLocked()->willReturn(false); $taxAdjustment->setAdjustable(null)->shouldBeCalled(); $this->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT); $this->getAdjustments()->count()->shouldReturn(1); //one has been removed $this->getAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->count()->shouldReturn(0); //tax adjustment has been removed }
/** * Helper method * * @param OrderInterface $order * @param AdjustmentInterface $shippingAdjustment * @param AdjustmentInterface $taxAdjustment */ protected function addShippingAndTaxAdjustments(OrderInterface $order, AdjustmentInterface $shippingAdjustment, AdjustmentInterface $taxAdjustment) { $shippingAdjustment->getLabel()->willReturn(AdjustmentInterface::SHIPPING_ADJUSTMENT); $shippingAdjustment->setAdjustable($order)->shouldBeCalled(); $taxAdjustment->getLabel()->willReturn(AdjustmentInterface::TAX_ADJUSTMENT); $taxAdjustment->setAdjustable($order)->shouldBeCalled(); $order->addAdjustment($shippingAdjustment); $order->addAdjustment($taxAdjustment); }