/** * {@inheritdoc} */ public function fillAddressData(AddressInterface $address) { $this->getElement('first_name')->setValue($address->getFirstName()); $this->getElement('last_name')->setValue($address->getLastName()); $this->getElement('street')->setValue($address->getStreet()); $this->getElement('country')->selectOption($address->getCountryCode()); $this->getElement('city')->setValue($address->getCity()); $this->getElement('postcode')->setValue($address->getPostcode()); }
/** * @param AddressInterface $address * @param string $type */ private function specifyAddress(AddressInterface $address, $type) { $this->assertAddressType($type); $this->getElement(sprintf('%s_first_name', $type))->setValue($address->getFirstName()); $this->getElement(sprintf('%s_last_name', $type))->setValue($address->getLastName()); $this->getElement(sprintf('%s_street', $type))->setValue($address->getStreet()); $this->getElement(sprintf('%s_country', $type))->selectOption($address->getCountryCode() ?: 'Select'); $this->getElement(sprintf('%s_city', $type))->setValue($address->getCity()); $this->getElement(sprintf('%s_postcode', $type))->setValue($address->getPostcode()); if (null !== $address->getProvinceName()) { $this->waitForElement(5, sprintf('%s_province', $type)); $this->getElement(sprintf('%s_province', $type))->setValue($address->getProvinceName()); } }
/** * @param string $displayedAddress * @param AddressInterface $address * * @return bool */ private function isAddressValid($displayedAddress, AddressInterface $address) { return $this->hasAddressPart($displayedAddress, $address->getCompany(), true) && $this->hasAddressPart($displayedAddress, $address->getFirstName()) && $this->hasAddressPart($displayedAddress, $address->getLastName()) && $this->hasAddressPart($displayedAddress, $address->getPhoneNumber(), true) && $this->hasAddressPart($displayedAddress, $address->getStreet()) && $this->hasAddressPart($displayedAddress, $address->getCity()) && $this->hasAddressPart($displayedAddress, $address->getProvinceCode(), true) && $this->hasAddressPart($displayedAddress, $this->getCountryName($address->getCountryCode())) && $this->hasAddressPart($displayedAddress, $address->getPostcode()); }
/** * @When /^I specify the billing (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ * @When /^I specify the billing (address for "([^"]+)" from "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)")$/ * @When /^I (do not specify any billing address) information$/ */ public function iSpecifyTheBillingAddressAs(AddressInterface $address) { $this->iChooseTheDifferentBillingAddress(); $key = sprintf('billing_address_%s_%s', strtolower($address->getFirstName()), strtolower($address->getLastName())); $this->sharedStorage->set($key, $address); $this->addressPage->specifyBillingAddress($address); }
/** * @Then /^(address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+"(?:|, "[^"]+")) should be marked as my default address$/ */ public function addressShouldBeMarkedAsMyDefaultAddress(AddressInterface $address) { $actualFullName = $this->addressBookIndexPage->getFullNameOfDefaultAddress(); $expectedFullName = sprintf('%s %s', $address->getFirstName(), $address->getLastName()); Assert::same($expectedFullName, $actualFullName, sprintf('The default address should be of "%s", but is of "%s".', $expectedFullName, $actualFullName)); }
/** * {@inheritdoc} */ public function specifyBillingAddress(AddressInterface $billingAddress) { $this->getElement('billing_first_name')->setValue($billingAddress->getFirstName()); $this->getElement('billing_last_name')->setValue($billingAddress->getLastName()); $this->getElement('billing_street')->setValue($billingAddress->getStreet()); $this->getElement('billing_country')->selectOption($this->getCountryNameOrDefault($billingAddress->getCountryCode())); $this->getElement('billing_city')->setValue($billingAddress->getCity()); $this->getElement('billing_postcode')->setValue($billingAddress->getPostcode()); }
/** * {@inheritdoc} */ public function specifyBillingAddress(AddressInterface $billingAddress) { $this->getElement('billing_first_name')->setValue($billingAddress->getFirstName()); $this->getElement('billing_last_name')->setValue($billingAddress->getLastName()); $this->getElement('billing_street')->setValue($billingAddress->getStreet()); $this->getElement('billing_country')->selectOption($billingAddress->getCountryCode() ?: 'Select'); $this->getElement('billing_city')->setValue($billingAddress->getCity()); $this->getElement('billing_postcode')->setValue($billingAddress->getPostcode()); if (null !== $billingAddress->getProvinceName()) { $this->waitForElement(5, 'billing_province'); $this->getElement('billing_province')->setValue($billingAddress->getProvinceName()); } }