本文整理汇总了PHP中mage\checkout\test\page\CheckoutCart::getCartBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart::getCartBlock方法的具体用法?PHP CheckoutCart::getCartBlock怎么用?PHP CheckoutCart::getCartBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mage\checkout\test\page\CheckoutCart
的用法示例。
在下文中一共展示了CheckoutCart::getCartBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that products' MAP has been applied before checkout.
*
* @param CatalogCategory $category
* @param Customer $customer
* @param Address $address
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $cart
* @param CheckoutOnepage $checkoutOnePage
* @param array $products
* @return void
*/
public function processAssert(CatalogCategory $category, Customer $customer, Address $address, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CheckoutCart $cart, CheckoutOnepage $checkoutOnePage, array $products)
{
for ($i = 0; $i < count($products); $i++) {
$cart->getCartBlock()->clearShoppingCart();
$productName = $products[$i]->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($category->getName());
// Check that price is not present on category page.
$listProductBlock = $catalogCategoryView->getListProductBlock();
$productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
$productPriceBlock->clickForPrice();
\PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
// Check that price is not present on product page.
$listProductBlock->openProductViewPage($productName);
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
// Check that price is not present on cart.
$catalogProductView->getViewBlock()->addToCart($products[$i]);
\PHPUnit_Framework_Assert::assertTrue($cart->getCartBlock()->getCartItem($products[$i])->isMsrpVisible(), "MSRP link is not visible in cart.");
// Check that price is present on review block in onepage checkout page.
$cart->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
$checkoutMethodBlock = $checkoutOnePage->getLoginBlock();
$billingBlock = $checkoutOnePage->getBillingBlock();
$paymentMethodBlock = $checkoutOnePage->getPaymentMethodsBlock();
$shippingBlock = $checkoutOnePage->getShippingMethodBlock();
$checkoutMethodBlock->guestCheckout();
$checkoutMethodBlock->clickContinue();
$billingBlock->fillBilling($address, $customer);
$billingBlock->clickContinue();
$shippingBlock->selectShippingMethod(['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']);
$shippingBlock->clickContinue();
$paymentMethodBlock->selectPaymentMethod(['method' => 'checkmo']);
$paymentMethodBlock->clickContinue();
\PHPUnit_Framework_Assert::assertEquals(number_format($products[$i]->getPrice(), 2), $checkoutOnePage->getReviewBlock()->getTotalBlock()->getData('subtotal'), "Subtotal in checkout one page for {$productName} is not equal to expected.");
}
}
示例2: processAssert
/**
* Assert that products are present in shopping cart.
*
* @param CheckoutCart $checkoutCart
* @param array $products
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, array $products)
{
$checkoutCart->open();
foreach ($products as $product) {
\PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCartBlock()->getCartItem($product)->isVisible(), "Product '{$product->getName()}' is absent in shopping cart.");
}
}
示例3: updateShoppingCart
/**
* Update shopping cart.
*
* @param CatalogProductSimple $product
* @return void
*/
protected function updateShoppingCart(CatalogProductSimple $product)
{
$qty = $product->getCheckoutData()['qty'];
$this->checkoutCart->open();
$this->checkoutCart->getCartBlock()->getCartItem($product)->setQty($qty);
$this->checkoutCart->getCartBlock()->updateShoppingCart();
}
示例4: assertPrice
/**
* Assert prices on the product view page and shopping cart page.
*
* @param CheckoutCart $checkoutCartView
* @return void
*/
protected function assertPrice(CheckoutCart $checkoutCartView)
{
$formCartItem = $checkoutCartView->getCartBlock()->getCartItem($this->product);
$fixtureCartItem = $this->product->getCheckoutData()['cartItem'];
$this->assertCartOptions($fixtureCartItem['options']['bundle_options'], $formCartItem->getOptions());
$this->assertCartPrice($fixtureCartItem['price'], $formCartItem->getCartItemTypePrice('price'));
}
示例5: assertOnShoppingCart
/**
* Assert prices on the shopping cart.
*
* @param InjectableFixture $product
* @param CheckoutCart $checkoutCart
* @return void
*/
protected function assertOnShoppingCart(InjectableFixture $product, CheckoutCart $checkoutCart)
{
$cartItem = $checkoutCart->getCartBlock()->getCartItem($product);
$formPrice = $cartItem->getCartItemTypePrice('price');
$fixturePrice = number_format($this->prepareFixturePrice($product), 2);
\PHPUnit_Framework_Assert::assertEquals($fixturePrice, $formPrice, 'Product price in shopping cart is not correct.');
}
示例6: removeProducts
/**
* Remove products form cart.
*
* @param array $products
* @return void
*/
protected function removeProducts(array $products)
{
$this->cartPage->open();
foreach ($products as $product) {
$this->cartPage->getCartBlock()->getCartItem($product)->removeItem();
}
}
示例7: processAssert
/**
* Assertion that the product is correctly displayed in cart.
*
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutData = $product->getCheckoutData();
$price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
}
示例8: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CheckoutCart $pageCheckoutCart
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$pageCatalogProductView->getViewBlock()->addToCart($product);
$actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
}
示例9: processAssert
/**
* Assert that product products' MAP has been applied in cart.
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param CatalogCategory $category
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $cart
* @param array $products
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogCategory $category, CatalogProductView $catalogProductView, CheckoutCart $cart, array $products)
{
foreach ($products as $product) {
$cart->getCartBlock()->clearShoppingCart();
$productName = $product->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($category->getName());
$listProductBlock = $catalogCategoryView->getListProductBlock();
// Check that price is not present on category page.
$productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
$productPriceBlock->clickForPrice();
\PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
// Check that price is not present on product page.
$listProductBlock->openProductViewPage($productName);
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
// Check that price is present in cart.
$catalogProductView->getViewBlock()->addToCart($product);
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $cart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price'), "MAP of {$productName} product in cart is not equal to product price.");
}
}
示例10: processAssert
/**
* Assert that product is not displayed in cross-sell section.
*
* @param BrowserInterface $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $promotedProducts = null)
{
if (!$promotedProducts) {
$promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
}
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutCart->open();
foreach ($promotedProducts as $promotedProduct) {
\PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->getItemBlock($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in cross-sell section.');
}
}
示例11: processAssert
/**
* Assert that product is displayed in cross-sell section.
*
* @param BrowserInterface $browser
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
{
$errors = [];
if (!$promotedProducts) {
$promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
}
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutCart->open();
foreach ($promotedProducts as $promotedProduct) {
if (!$checkoutCart->getCrosssellBlock()->verifyProductCrosssell($promotedProduct)) {
$errors[] = 'Product \'' . $promotedProduct->getName() . '\' is absent in cross-sell section.';
}
}
\PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
}
示例12: processAssert
/**
* Assert that product is displayed in cross-sell section for customer segment.
*
* @param Browser $browser
* @param Customer $customer
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param CustomerAccountLogout $customerAccountLogout
* @param InjectableFixture[] $promotedProducts
* @return void
*/
public function processAssert(Browser $browser, Customer $customer, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, CustomerAccountLogout $customerAccountLogout, array $promotedProducts)
{
// Create customer, logout and login to frontend
$customer->persist();
$customerAccountLogout->open();
$this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
// Clear cart
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
// Check display cross sell products
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$checkoutCart->open();
$errors = [];
foreach ($promotedProducts as $promotedProduct) {
if (!$checkoutCart->getCrosssellBlock()->getItemBlock($promotedProduct)->isVisible()) {
$errors[] = "Product '{$promotedProduct->getName()}' is absent in cross-sell section.";
}
}
\PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
}
示例13: processAssert
/**
* Assert that $dataType in the shopping cart equals to expected $dataType from data set.
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param array $verifyData [optional]
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, array $verifyData = [])
{
$checkoutCart->open();
/** @var Items $sourceProducts */
$sourceProducts = $cart->getDataFieldConfig('items')['source'];
$products = $sourceProducts->getProducts();
$items = $cart->getItems();
$productsData = [];
$cartData = [];
foreach ($items as $key => $item) {
/** @var CatalogProductSimple $product */
$product = $products[$key];
$data = isset($verifyData[$key]) ? $verifyData[$key] : [];
$productName = $product->getName();
/** @var FixtureInterface $item */
$checkoutItem = $item->getData();
$cartItem = $checkoutCart->getCartBlock()->getCartItem($product);
$productsData[$productName] = $this->getProductData($checkoutItem, $data);
$cartData[$productName] = $this->getCartData($cartItem);
}
$error = $this->verifyContainsData($productsData, $cartData);
\PHPUnit_Framework_Assert::assertEmpty($error, $error);
}
示例14: run
/**
* Checkout with Pay Pal.
*
* @return void
*/
public function run()
{
$this->checkoutCart->getCartBlock()->getExpressShortcutBlock()->checkoutWithPayPal();
}
示例15: processAssert
/**
* Assert that shopping cart is empty.
*
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart)
{
$checkoutCart->open();
\PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCartBlock()->emptyCartBlockIsVisible(), "Shopping cart is not empty.");
}