本文整理汇总了PHP中mage\checkout\test\page\CheckoutCart类的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart类的具体用法?PHP CheckoutCart怎么用?PHP CheckoutCart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckoutCart类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:AssertProductInCart.php
示例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.");
}
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:AssertProductsPresentInShoppingCart.php
示例3: 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.");
}
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:49,代码来源:AssertProductMapAppliedBeforeCheckout.php
示例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'));
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:13,代码来源:AssertBundlePriceType.php
示例5: processAssert
/**
* Assert that grand total is equal to expected.
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param Customer|null $customer
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, Customer $customer = null)
{
if ($customer !== null) {
$this->login($customer);
}
$checkoutCart->open();
\PHPUnit_Framework_Assert::assertEquals(number_format($cart->getGrandTotal(), 2), $checkoutCart->getTotalsBlock()->getData('grand_total'));
}
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:16,代码来源:AssertGrandTotalInShoppingCart.php
示例6: 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.');
}
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:17,代码来源:AssertConfigurableProductInCart.php
示例7: processAssert
/**
* Assert that gift card usable in frontend.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param Browser $browser
* @param string $code
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CatalogProductSimple $product, Browser $browser, $code)
{
$this->checkoutCart = $checkoutCart;
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCart();
$checkoutCart->getGiftCardAccountBlock()->addGiftCard($code);
$this->assert();
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:18,代码来源:AbstractAssertGiftCardAccountUsableInCartOnFrontend.php
示例8: processAssert
/**
* 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());
}
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:16,代码来源:AssertProductConfiguringFromRequiringAttention.php
示例9: processAssert
/**
* Assert that after adding products by sku, wrong requested quantity error message appears.
*
* @param CheckoutCart $checkoutCart
* @param array $requiredAttentionProducts
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
{
foreach ($requiredAttentionProducts as $product) {
$currentMessage = $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product);
\PHPUnit_Framework_Assert::assertContains(self::ERROR_QUANTITY_MESSAGE, $currentMessage);
\PHPUnit_Framework_Assert::assertContains(sprintf($this->allowedQtyMessage, $product->getStockData()[$this->saleQtyType]), $currentMessage);
}
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:15,代码来源:AbstractAssertRequestedQtyFailMessage.php
示例10: processAssert
/**
* Assert that requested quantity is not available error message is displayed after adding products to cart by sku.
*
* @param CheckoutCart $checkoutCart
* @param array $requiredAttentionProducts
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, $requiredAttentionProducts)
{
foreach ($requiredAttentionProducts as $product) {
$currentMessage = $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product);
\PHPUnit_Framework_Assert::assertContains(self::ERROR_QUANTITY_MESSAGE, $currentMessage);
\PHPUnit_Framework_Assert::assertContains(sprintf(self::LEFT_IN_STOCK_ERROR_MESSAGE, $product->getStockData()['qty']), $currentMessage);
}
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:15,代码来源:AssertQtyIsNotEnoughFailMessage.php
示例11: processAssert
/**
* Assert that product can be added to active gift registry from shopping cart.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture $product
* @param GiftRegistry $giftRegistry
* @param GiftRegistryItems $giftRegistryItems
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $product, GiftRegistry $giftRegistry, GiftRegistryItems $giftRegistryItems, BrowserInterface $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$checkoutCart->open();
$checkoutCart->getGiftRegistryBlock()->addToGiftRegistry($giftRegistry);
\PHPUnit_Framework_Assert::assertTrue($giftRegistryItems->getGiftRegistryItemsBlock()->isProductInGrid($product), "Product can not be added to active gift registry '{$giftRegistry->getTitle()}' from shopping cart.");
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:20,代码来源:AssertGiftRegistryActiveInShoppingCart.php
示例12: 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);
}
开发者ID:test3metizsoft,项目名称:test,代码行数:21,代码来源:AssertCatalogPriceRuleAppliedInShoppingCart.php
示例13: test
/**
* Run Move from ShoppingCard to Wishlist test.
*
* @param Customer $customer
* @param CheckoutCart $checkoutCart
* @param string $product
* @return array
*/
public function test(Customer $customer, CheckoutCart $checkoutCart, $product)
{
// Preconditions:
$product = $this->createProducts($product)[0];
$this->loginCustomer($customer);
// Steps:
$this->addToCart($product);
$checkoutCart->open()->getCartBlock()->getCartItem($product)->moveToWishlist();
return ['product' => $product];
}
开发者ID:cewolf2002,项目名称:magento,代码行数:18,代码来源:MoveProductFromShoppingCartToWishlistTest.php
示例14: processAssert
/**
* Assert that created gift card account can be verified on the frontend in Shopping Cart.
*
* @param Customer $customer
* @param Browser $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param GiftCardAccount $giftCardAccount
* @param CheckoutCart $checkoutCart
* @param string $code
* @return void
*/
public function processAssert(Customer $customer, Browser $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, GiftCardAccount $giftCardAccount, CheckoutCart $checkoutCart, $code)
{
$this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCart();
$data = $giftCardAccount->getData();
$checkoutCart->getGiftCardAccountBlock()->checkStatusAndBalance($code);
$fixtureData = ['code' => $code, 'balance' => $data['balance'], 'date_expires' => $data['date_expires']];
\PHPUnit_Framework_Assert::assertEquals($fixtureData, $checkoutCart->getCheckBlock()->getGiftCardAccountData($fixtureData));
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:22,代码来源:AssertGiftCardAccountStatusInShoppingCart.php
示例15: processAssert
/**
* Assert that banner is absent on Shopping Cart page.
*
* @param Browser $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param Banner $banner
* @param CheckoutCart $checkoutCart
* @param Cache $adminCache
* @return void
*/
public function processAssert(Browser $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, Banner $banner, CheckoutCart $checkoutCart, Cache $adminCache)
{
// Flush cache
$adminCache->open();
$adminCache->getPageActions()->flushCacheStorage();
$adminCache->getMessagesBlock()->waitSuccessMessage();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
\PHPUnit_Framework_Assert::assertFalse($checkoutCart->getBannerViewBlock()->checkWidgetBanners($banner), 'Banner is present on Shopping Cart page.');
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:21,代码来源:AssertBannerNotInShoppingCart.php
示例16: 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.');
}
}
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:24,代码来源:AssertProductAbsentCrossSells.php
示例17: processAssert
/**
* Assert that product has tier price message appears after adding products by sku to shopping cart.
*
* @param CheckoutCart $checkoutCart
* @param array $requiredAttentionProducts
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
{
foreach ($requiredAttentionProducts as $product) {
$messages = $checkoutCart->getAdvancedCheckoutCart()->getTierPriceMessages($product);
$tierPrices = $product->getTierPrice();
\PHPUnit_Framework_Assert::assertTrue(count($messages) === count($tierPrices), 'Wrong qty messages is displayed.');
foreach ($tierPrices as $key => $tierPrice) {
$price = (bool) strpos($messages[$key], (string) $tierPrice['price']);
$priceQty = (bool) strpos($messages[$key], (string) $tierPrice['price_qty']);
$savePercent = (bool) strpos($messages[$key], $this->getSavePercent($product->getPrice(), $tierPrice));
\PHPUnit_Framework_Assert::assertTrue($price and $priceQty and $savePercent, 'Wrong tier price message is displayed.');
}
}
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:21,代码来源:AssertProductTierPriceMessage.php
示例18: processAssert
/**
* Assert that products are displayed in cross-sell section.
*
* @param Browser $browser
* @param CheckoutCart $checkoutCart
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param InjectableFixture[] $crossSellProducts
* @return void
*/
public function processAssert(Browser $browser, CheckoutCart $checkoutCart, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $crossSellProducts)
{
$checkoutCart->open()->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$errors = [];
$crosssellBlock = $checkoutCart->getCrosssellBlock();
foreach ($crossSellProducts as $crossSellProduct) {
if (!$crosssellBlock->getItemBlock($crossSellProduct)->isVisible()) {
$errors[] = "Product {$crossSellProduct->getName()} is absent in cross-sell section.";
}
}
\PHPUnit_Framework_Assert::assertEmpty($errors, implode(" ", $errors));
}
开发者ID:cewolf2002,项目名称:magento,代码行数:24,代码来源:AssertCrossSellProductsSection.php
示例19: processAssert
/**
* Assert that Gift Wrapping can be found during one page checkout on frontend.
*
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param BrowserInterface $browser
* @param CheckoutOnepage $checkoutOnepage
* @param GiftWrapping $giftWrapping
* @param Address $billingAddress
* @param CatalogProductSimple $product
* @param Customer $customer
* @param CustomerAccountLogout $customerAccountLogout
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, BrowserInterface $browser, CheckoutOnepage $checkoutOnepage, GiftWrapping $giftWrapping, Address $billingAddress, CatalogProductSimple $product, Customer $customer, CustomerAccountLogout $customerAccountLogout)
{
// Preconditions
$customer->persist();
$product->persist();
// Steps
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$checkoutCart->open()->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
$checkoutOnepage->getLoginBlock()->loginCustomer($customer);
$checkoutOnepage->getBillingBlock()->fillBilling($billingAddress);
$checkoutOnepage->getBillingBlock()->clickContinue();
\PHPUnit_Framework_Assert::assertContains($giftWrapping->getDesign(), $checkoutOnepage->getGiftOptionsBlock()->getGiftWrappingsAvailable(), "Gift Wrapping '{$giftWrapping->getDesign()}' is not present in one page checkout on frontend.");
$customerAccountLogout->open();
}
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:29,代码来源:AssertGiftWrappingOnFrontendCheckout.php
示例20: 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));
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:28,代码来源:AssertProductCrossSells.php
注:本文中的mage\checkout\test\page\CheckoutCart类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论