/** * @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()))); }
/** * @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))); }
/** * @param ProductInterface $product * @param int $amount */ private function assertNumberOfVariantsOnProductPage(ProductInterface $product, $amount) { $this->iWantToViewAllVariantsOfThisProduct($product); Assert::same((int) $this->indexPage->countItems(), $amount, 'Product has %d variants, but should have %d'); }