9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Checkout\Test\Page\CheckoutCart;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 use Magento\Mtf\Fixture\FixtureInterface;
25 private $errorMessage =
'The most you may purchase is %s.';
38 BrowserInterface $browser,
40 CatalogProductView $catalogProductView,
45 $checkoutCart->open()->getCartBlock()->clearShoppingCart();
47 $browser->open($_ENV[
'app_frontend_url'] .
$product->getUrlKey() .
'.html');
48 $catalogProductView->getViewBlock()->waitLoader();
49 $catalogProductView->getViewBlock()->setQtyAndClickAddToCart($maxQty * 2);
50 \PHPUnit\Framework\Assert::assertEquals(
51 $catalogProductView->getMessagesBlock()->getErrorMessage(),
52 sprintf($this->errorMessage, $maxQty),
53 'The maximum purchase warning message is not appears.' 56 $catalogProductView->getViewBlock()->setQtyAndClickAddToCart($maxQty);
57 \PHPUnit\Framework\Assert::assertTrue(
58 $catalogProductView->getMessagesBlock()->waitSuccessMessage(),
59 'Limiting max qty is not working correctly.' 70 return 'Limiting max qty is working correctly.';
processAssert(BrowserInterface $browser, FixtureInterface $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, $maxQty)