Ejemplo n.º 1
0
 /**
  * Delete additional address.
  *
  * @param Address $address
  * @return void
  */
 public function deleteAddress(Address $address)
 {
     $addressItemSelector = sprintf($this->addressItem, $address->getStreet());
     $addressItem = $this->_rootElement->find($addressItemSelector, Locator::SELECTOR_XPATH);
     $addressItem->find($this->deleteAddress)->click();
     $this->browser->acceptAlert();
 }
Ejemplo n.º 2
0
 /**
  * Fill address data.
  *
  * @param Address $address
  * @return void
  */
 protected function fillAddress(Address $address)
 {
     $skipFields = ['email', 'default_shipping'];
     $addressData = $address->getData();
     $addressData = array_flip(array_diff(array_flip($addressData), $skipFields));
     $mapping = $this->dataMapping($addressData);
     $this->_fill($mapping);
 }
 /**
  * Prepare data.
  *
  * @param Customer $customer
  * @param Customer $initialCustomer [optional]
  * @param Address $address [optional]
  * @return array
  */
 protected function prepareData(Customer $customer, Customer $initialCustomer = null, Address $address = null)
 {
     if ($initialCustomer) {
         $data['customer'] = $customer->hasData() ? array_merge($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
     } else {
         $data['customer'] = $customer->getData();
     }
     if ($address) {
         $data['addresses'][1] = $address->hasData() ? $address->getData() : [];
     } else {
         $data['addresses'] = [];
     }
     return $data;
 }
Ejemplo n.º 4
0
 /**
  * Check necessary field to retrieve according to address country.
  *
  * @return string
  */
 protected function resolveRegion()
 {
     return $this->address->hasData('region') ? 'region' : 'region_id';
 }
 /**
  * 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();
 }
Ejemplo n.º 6
0
 /**
  * Prepare address data.
  *
  * @param Address $address
  * @return string
  */
 protected function prepareAddressData(Address $address)
 {
     return $address->getFirstname() . ' ' . $address->getLastname() . ', ' . $address->getStreet() . ', ' . $address->getCity() . ', ' . $address->getRegionId() . ' ' . $address->getPostcode() . ', ' . $address->getCountryId();
 }
 /**
  * Prepare address data.
  *
  * @param Address $address
  * @return string
  */
 protected function prepareAddressData(Address $address)
 {
     $result = $address->getFirstname() . " " . $address->getLastname() . "\n" . $address->getCompany() . "\n" . $address->getStreet() . "\n" . $address->getCity() . ", " . $address->getRegionId() . ", " . $address->getPostcode() . "\n" . $address->getCountryId() . "\n" . "T: " . $address->getTelephone();
     if ($address->hasData('fax')) {
         $result .= "\nF: " . $address->getFax();
     }
     return $result;
 }