當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CheckoutCart::open方法代碼示例

本文整理匯總了PHP中mage\checkout\test\page\CheckoutCart::open方法的典型用法代碼示例。如果您正苦於以下問題:PHP CheckoutCart::open方法的具體用法?PHP CheckoutCart::open怎麽用?PHP CheckoutCart::open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mage\checkout\test\page\CheckoutCart的用法示例。


在下文中一共展示了CheckoutCart::open方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Add products to the cart.
  *
  * @return void
  */
 public function run()
 {
     // Ensure that shopping cart is empty
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     foreach ($this->products as $product) {
         $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         $this->catalogProductView->getViewBlock()->addToCart($product);
     }
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:14,代碼來源:AddProductsToTheCartStep.php

示例2: 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

示例3: 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

示例4: 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();
     }
 }
開發者ID:MikeTayC,項目名稱:magento.dev,代碼行數:13,代碼來源:DeleteProductsFromShoppingCartTest.php

示例5: processAssert

 /**
  * 1. Navigate to frontend
  * 2. If "Log Out" link is visible and "isLoggedIn" empty
  *    - makes logout
  * 3. If "isLoggedIn" not empty
  *    - login as customer
  * 4. Clear shopping cart
  * 5. Add test product(s) to shopping cart with specify quantity
  * 6. If "salesRule/data/coupon_code" not empty:
  *    - fill "Enter your code" input in Dіscount Codes
  *    - click "Apply Coupon" button
  * 7. If "address/data/country_id" not empty:
  *    On Estimate Shipping and Tax:
  *    - fill Country, State/Province, Zip/Postal Code
  *    - click 'Get a Quote' button
  *    - select 'Flat Rate' shipping
  *    - click 'Update Total' button
  * 8. Implementation assert
  *
  * @param CheckoutCart $checkoutCart
  * @param CmsIndex $cmsIndex
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param Customer $customer
  * @param SalesRule $salesRule
  * @param Address $address
  * @param Browser $browser
  * @param array $productQuantity
  * @param CatalogProductSimple $productForSalesRule1
  * @param CatalogProductSimple $productForSalesRule2
  * @param array $shipping [optional]
  * @param int|null $isLoggedIn
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(CheckoutCart $checkoutCart, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, Customer $customer, SalesRule $salesRule, Address $address, Browser $browser, array $productQuantity, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2, array $shipping = [], $isLoggedIn = null)
 {
     $this->checkoutCart = $checkoutCart;
     $this->cmsIndex = $cmsIndex;
     $this->customerAccountLogin = $customerAccountLogin;
     $this->customerAccountLogout = $customerAccountLogout;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->customer = $customer;
     $this->browser = $browser;
     $this->productForSalesRule1 = $productForSalesRule1;
     $this->productForSalesRule2 = $productForSalesRule2;
     $isLoggedIn ? $this->login() : $this->customerAccountLogout->open();
     $this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $this->addProductsToCart($productQuantity);
     if ($address->hasData('country_id')) {
         $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
         if (!empty($shipping)) {
             $this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
         }
     }
     if ($salesRule->getCouponCode()) {
         $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($salesRule->getCouponCode());
     }
     $this->assert();
 }
開發者ID:cewolf2002,項目名稱:magento,代碼行數:64,代碼來源:AbstractCartPriceRuleApplying.php

示例6: 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();
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:13,代碼來源:UpdateShoppingCartTest.php

示例7: 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

示例8: 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

示例9: processAssert

 /**
  * Assert that displayed price for bundle items on shopping cart page equals to passed from fixture.
  *   Price for bundle items has two options:
  *   1. Fixed (price of bundle product)
  *   2. Dynamic (price of bundle item)
  *
  * @param CatalogProductView $catalogProductView
  * @param BundleProduct $product
  * @param CheckoutCart $checkoutCartView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, BundleProduct $product, CheckoutCart $checkoutCartView, Browser $browser)
 {
     $this->product = $product;
     $checkoutCartView->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     //Process assertions
     $this->assertPrice($checkoutCartView);
 }
開發者ID:QiuLihua83,項目名稱:magento-ee,代碼行數:21,代碼來源:AssertBundlePriceType.php

示例10: 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

示例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: 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

示例13: 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));
 }
開發者ID:MikeTayC,項目名稱:magento.dev,代碼行數:34,代碼來源:AssertProductCrossSellsForCustomerSegment.php

示例14: 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

示例15: 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


注:本文中的mage\checkout\test\page\CheckoutCart::open方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。