/** * Assert that product can be configured and added to cart after added this product to cart by sku. * * @param CheckoutCart $checkoutCart * @param CatalogProductView $catalogProductView * @param array $requiredAttentionProducts * @return void */ public function processAssert(CheckoutCart $checkoutCart, CatalogProductView $catalogProductView, array $requiredAttentionProducts) { foreach ($requiredAttentionProducts as $product) { $checkoutCart->open()->getAdvancedCheckoutCart()->clickSpecifyProductOptionsLink($product); $catalogProductView->getViewBlock()->addToCart($product); \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_MESSAGE, $product->getName()), $checkoutCart->getMessagesBlock()->getSuccessMessages()); } }
/** * Login to frontend. Create product. Adding product to shopping cart. * * @param CheckoutCart $checkoutCart * @param CatalogProductSimple $product * @param CmsIndex $cmsIndex * @param CustomerAccountLogout $customerAccountLogout * @param CatalogProductView $catalogProductView * @param Customer $customer * @param CustomerSegment $customerSegment * @param CustomerSegmentIndex $customerSegmentIndex * @param BrowserInterface $browser * @param CustomerSegmentNew $customerSegmentNew * @return void */ public function processAssert(CheckoutCart $checkoutCart, CatalogProductSimple $product, CmsIndex $cmsIndex, CustomerAccountLogout $customerAccountLogout, CatalogProductView $catalogProductView, Customer $customer, CustomerSegment $customerSegment, CustomerSegmentIndex $customerSegmentIndex, BrowserInterface $browser, CustomerSegmentNew $customerSegmentNew) { $this->checkoutCart = $checkoutCart; $this->cmsIndex = $cmsIndex; $this->customerAccountLogout = $customerAccountLogout; $this->catalogProductView = $catalogProductView; $this->customer = $customer; $this->customerSegment = $customerSegment; $this->customerSegmentIndex = $customerSegmentIndex; $this->customerSegmentNew = $customerSegmentNew; $this->cmsIndex->open(); $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run(); $product->persist(); $this->checkoutCart->open()->getCartBlock()->clearShoppingCart(); $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $this->catalogProductView->getViewBlock()->clickAddToCart(); $this->checkoutCart->getMessagesBlock()->getSuccessMessages(); $this->assert(); $this->customerAccountLogout->open(); }
/** * Assert that success apply gift card message is displayed on shopping cart page. * * @param CheckoutCart $checkoutCart * @param GiftCardAccount $giftCardAccount * @return void */ public function processAssert(CheckoutCart $checkoutCart, GiftCardAccount $giftCardAccount) { \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_APPLY_MESSAGE, $giftCardAccount->getCode()), $checkoutCart->getMessagesBlock()->getSuccessMessages(), 'Wrong success message is displayed.'); }
/** * Assert that success message is displayed after adding products by sku to shopping cart. * * @param CheckoutCart $checkoutCart * @param array $products * @return void */ public function processAssert(CheckoutCart $checkoutCart, array $products) { $productsQty = count($products); $qtyString = $productsQty > 1 ? 'products were' : 'product was'; \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_MESSAGE, $productsQty, $qtyString), $checkoutCart->getMessagesBlock()->getSuccessMessages()); }
/** * Assert that product requires attention error message is displayed after adding products by sku to shopping cart. * * @param CheckoutCart $checkoutCart * @param array $requiredAttentionProducts * @return void */ public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts) { $productsQty = count($requiredAttentionProducts); $qtyString = $productsQty > 1 ? 'products' : 'product'; \PHPUnit_Framework_Assert::assertEquals(sprintf(self::ERROR_MESSAGE, $productsQty, $qtyString), $checkoutCart->getMessagesBlock()->getErrorMessages()); }