本文整理汇总了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);
}
}
示例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.');
}
}
示例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.");
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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());
}
}
示例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'));
}
示例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);
}
示例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));
}
示例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.");
}
示例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];
}
示例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));
}
示例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));
}
示例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();
}