本文整理汇总了PHP中Magento\Checkout\Test\Page\CheckoutCart::getShippingBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart::getShippingBlock方法的具体用法?PHP CheckoutCart::getShippingBlock怎么用?PHP CheckoutCart::getShippingBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Checkout\Test\Page\CheckoutCart
的用法示例。
在下文中一共展示了CheckoutCart::getShippingBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 SalesRule $salesRule
* @param SalesRule $salesRuleOrigin
* @param array $productQuantity
* @param CatalogProductSimple $productForSalesRule1
* @param CatalogProductSimple $productForSalesRule2
* @param Customer $customer
* @param Address $address
* @param int|null $isLoggedIn
* @param array $shipping
* @param array $cartPrice
* @return void
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function processAssert(CheckoutCart $checkoutCart, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, SalesRule $salesRule, SalesRule $salesRuleOrigin, array $productQuantity, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2 = null, Customer $customer = null, Address $address = null, $isLoggedIn = null, array $shipping = [], array $cartPrice = [])
{
$this->checkoutCart = $checkoutCart;
$this->cmsIndex = $cmsIndex;
$this->customerAccountLogin = $customerAccountLogin;
$this->customerAccountLogout = $customerAccountLogout;
$this->catalogCategoryView = $catalogCategoryView;
$this->catalogProductView = $catalogProductView;
$this->productForSalesRule1 = $productForSalesRule1;
$this->productForSalesRule2 = $productForSalesRule2;
$this->cartPrice = $cartPrice;
if ($customer !== null) {
$this->customer = $customer;
}
$isLoggedIn ? $this->login() : $this->customerAccountLogout->open();
$this->checkoutCart->open()->getCartBlock()->clearShoppingCart();
$this->addProductsToCart($productQuantity);
$this->checkoutCart->open();
if ($address !== null) {
$this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
$this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
}
if ($salesRule->getCouponCode() || $salesRuleOrigin->getCouponCode()) {
$this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($salesRule->getCouponCode() ? $salesRule->getCouponCode() : $salesRuleOrigin->getCouponCode());
}
$this->assert();
}
示例2: run
/**
* Estimate shipping and tax and process assertions for totals.
*
* @return void
*/
public function run()
{
$this->checkoutCart->open();
$this->checkoutCart->getCartBlock()->waitCartContainerLoading();
/** @var \Magento\Checkout\Test\Fixture\Cart $cart */
if ($this->cart !== null) {
$cart = $this->fixtureFactory->createByCode('cart', ['data' => array_merge($this->cart->getData(), ['items' => ['products' => $this->products]])]);
$this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address);
if (!empty($this->shipping)) {
$this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping);
}
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
$this->assertEstimateShippingAndTax->processAssert($this->checkoutCart, $cart, false);
}
}
示例3: test
/**
* Automatic Apply Tax Based on VAT ID.
*
* @param ConfigData $vatConfig
* @param OrderInjectable $order
* @param TaxRule $taxRule
* @param Cart $cart
* @param string $configData
* @param string $customerGroup
* @return array
*/
public function test(ConfigData $vatConfig, OrderInjectable $order, TaxRule $taxRule, Cart $cart, $configData, $customerGroup)
{
// Preconditions
$this->configData = $configData;
$this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run();
$taxRule->persist();
// Prepare data
$this->customer = $order->getDataFieldConfig('customer_id')['source']->getCustomer();
$address = $this->customer->getDataFieldConfig('address')['source']->getAddresses()[0];
$this->prepareVatConfig($vatConfig, $customerGroup);
$poducts = $order->getEntityId()['products'];
$cart = $this->fixtureFactory->createByCode('cart', ['data' => array_merge($cart->getData(), ['items' => ['products' => $poducts]])]);
// Steps
$order->persist();
$this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run();
$this->objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $order->getEntityId())->run();
$this->checkoutCart->open();
$this->checkoutCart->getCartBlock()->waitCartContainerLoading();
$this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
$this->checkoutCart->getCartBlock()->waitCartContainerLoading();
return ['customer' => $this->customer, 'address' => $address, 'orderId' => $order->getId(), 'cart' => $cart, 'products' => $poducts];
}
示例4: processAssert
/**
* 1. Creating product simple with custom tax product class
* 2. Log In as customer
* 3. Add product to shopping cart
* 4. Estimate Shipping and Tax
* 5. Implementation assert
*
* @param FixtureFactory $fixtureFactory
* @param TaxRule $taxRule
* @param Customer $customer
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param Address $address
* @param array $shipping
* @param BrowserInterface $browser
* @param TaxRule $initialTaxRule
* @return void
*/
public function processAssert(FixtureFactory $fixtureFactory, TaxRule $taxRule, Customer $customer, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, Address $address, array $shipping, BrowserInterface $browser, TaxRule $initialTaxRule = null)
{
$this->initialTaxRule = $initialTaxRule;
$this->taxRule = $taxRule;
$this->checkoutCart = $checkoutCart;
$this->shipping = $shipping;
if ($this->initialTaxRule !== null) {
$this->taxRuleCode = $this->taxRule->hasData('code') ? $this->taxRule->getCode() : $this->initialTaxRule->getCode();
} else {
$this->taxRuleCode = $this->taxRule->getCode();
}
// Creating simple product with custom tax class
/** @var \Magento\Tax\Test\Fixture\TaxClass $taxProductClass */
$taxProductClass = $taxRule->getDataFieldConfig('tax_product_class')['source']->getFixture()[0];
$this->productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_100_dollar_for_tax_rule', 'data' => ['tax_class_id' => ['tax_product_class' => $taxProductClass]]]);
$this->productSimple->persist();
// Customer login
$this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
// Clearing shopping cart and adding product to shopping cart
$checkoutCart->open()->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->clickAddToCart();
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
// Estimate Shipping and Tax
$checkoutCart->open();
$checkoutCart->getShippingBlock()->openEstimateShippingAndTax();
$checkoutCart->getShippingBlock()->fill($address);
$checkoutCart->getShippingBlock()->clickGetQuote();
$checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
$this->assert();
}
示例5: processAssert
/**
* 1. Creating product simple with custom tax product class
* 2. Log In as customer
* 3. Add product to shopping cart
* 4. Estimate Shipping and Tax
* 5. Implementation assert
*
* @param FixtureFactory $fixtureFactory
* @param TaxRule $taxRule
* @param CustomerAccountLogin $customerAccountLogin
* @param CustomerAccountLogout $customerAccountLogout
* @param CustomerInjectable $customer
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param AddressInjectable $address
* @param array $shipping
* @param TaxRule $initialTaxRule
* @return void
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function processAssert(FixtureFactory $fixtureFactory, TaxRule $taxRule, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CustomerInjectable $customer, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, AddressInjectable $address, array $shipping, TaxRule $initialTaxRule = null)
{
$this->initialTaxRule = $initialTaxRule;
$this->taxRule = $taxRule;
$this->checkoutCart = $checkoutCart;
$this->shipping = $shipping;
if ($this->initialTaxRule !== null) {
$this->taxRuleCode = $this->taxRule->hasData('code') ? $this->taxRule->getCode() : $this->initialTaxRule->getCode();
} else {
$this->taxRuleCode = $this->taxRule->getCode();
}
// Creating simple product with custom tax class
/** @var \Magento\Tax\Test\Fixture\TaxClass $taxProductClass */
$taxProductClass = $taxRule->getDataFieldConfig('tax_product_class')['source']->getFixture()[0];
$this->productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => '100_dollar_product_for_tax_rule', 'data' => ['tax_class_id' => ['tax_product_class' => $taxProductClass]]]);
$this->productSimple->persist();
// Customer login
$customerAccountLogout->open();
$customerAccountLogin->open();
$customerAccountLogin->getLoginBlock()->login($customer);
// Clearing shopping cart and adding product to shopping cart
$checkoutCart->open()->getCartBlock()->clearShoppingCart();
$catalogProductView->init($this->productSimple);
$catalogProductView->open();
$catalogProductView->getViewBlock()->clickAddToCart();
// Estimate Shipping and Tax
$checkoutCart->getShippingBlock()->openEstimateShippingAndTax();
$checkoutCart->getShippingBlock()->fill($address);
$checkoutCart->getShippingBlock()->clickGetQuote();
$checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
$this->assert();
}
示例6: fillEstimateBlock
/**
* Fill estimate block.
*
* @param Address $address
* @param array $shipping
* @return void
*/
public function fillEstimateBlock(Address $address, $shipping)
{
$this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
$this->checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
}