/** * @Then /^(\d+) units of (this product) should be on hand$/ */ public function unitsOfThisProductShouldBeOnHand($quantity, ProductInterface $product) { /** @var ProductVariantInterface $variant */ $variant = $this->defaultProductVariantResolver->getVariant($product); $actualQuantity = $this->indexPage->getOnHandQuantityFor($variant); Assert::same((int) $quantity, $actualQuantity, sprintf('Unexpected on hand quantity for "%s" variant. It should be "%s" but is "%s"', $variant->getName(), $quantity, $actualQuantity)); }
/** * @Then the :variant variant of :product product should have :amount items on hold */ public function theVariantOfProductShouldHaveItemsOnHold(ProductVariantInterface $variant, ProductInterface $product, $amount) { $this->indexPage->open(['productId' => $product->getId()]); Assert::same($amount, $this->indexPage->getOnHoldQuantityFor($variant), sprintf('Unexpected on hold quantity for "%s" variant. It should be "%s" but is "%s"', $variant->getName(), $amount, $this->indexPage->getOnHandQuantityFor($variant))); }
/** * @Then /^there should be no units of (this product) on hold$/ */ public function thereShouldBeNoUnitsOfThisProductOnHold(ProductInterface $product) { Assert::eq(0, $this->indexPage->getOnHoldQuantityFor($product->getFirstVariant()), sprintf('Unexpected on hand quantity for "%s" variant. It should be "%s" but is "%s"', $product->getFirstVariant()->getName(), 0, $this->indexPage->getOnHandQuantityFor($product->getFirstVariant()))); }