/** * @Then /^(this variant) should not exist in the product catalog$/ */ public function productVariantShouldNotExist(ProductVariantInterface $productVariant) { $this->iWantToViewAllVariantsOfThisProduct($productVariant->getProduct()); Assert::false($this->indexPage->isSingleResourceOnPage(['name' => $productVariant->getName()]), sprintf('Product variant with code %s exists but should not.', $productVariant->getName())); }
/** * @Then /^I should see that the ("[^"]+" variant) has zero on hand quantity$/ */ public function iShouldSeeThatTheVariantHasZeroOnHandQuantity(ProductVariantInterface $productVariant) { Assert::true($this->indexPage->isSingleResourceOnPage(['name' => $productVariant->getName(), 'inventory' => '0 Available on hand']), sprintf('This "%s" variant should have 0 on hand quantity, but it does not.', $productVariant->getName())); }
function it_throws_invalid_argument_exception_if_on_hold_quantity_to_decrease_will_be_below_zero(OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant) { $productVariant->getOnHold()->willReturn(5); $productVariant->isTracked()->willReturn(true); $productVariant->getName()->willReturn('t-shirt'); $orderItem->getVariant()->willReturn($productVariant); $orderItem->getQuantity()->willReturn(10); $order->getItems()->willReturn([$orderItem]); $productVariant->setOnHold(-5)->shouldNotBeCalled(); $this->shouldThrow(\InvalidArgumentException::class)->during('decrease', [$order]); }