/** * Asserts that Default Billing Address and Default Shipping Address equal to data from fixture * * @param CustomerAccountIndex $customerAccountIndex * @param AddressInjectable $address * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, AddressInjectable $address) { $customerAccountIndex->getAccountMenuBlock()->openMenuItem('Account Dashboard'); $defaultBillingAddress = explode("\n", $customerAccountIndex->getDashboardAddress()->getDefaultBillingAddressText()); $defaultShippingAddress = explode("\n", $customerAccountIndex->getDashboardAddress()->getDefaultShippingAddressText()); $pattern = $this->makeAddressPattern($address); $billingDataDiff = $this->verifyForm($pattern, $defaultBillingAddress); $shippingDataDiff = $this->verifyForm($pattern, $defaultShippingAddress); $dataDiff = array_merge($billingDataDiff, $shippingDataDiff); \PHPUnit_Framework_Assert::assertEmpty($dataDiff, 'Billing or shipping form was filled incorrectly.' . "\nLog:\n" . implode(";\n", $dataDiff)); }
/** * Enable Automatic Assignment of Customers to Appropriate VAT Group. * * @param Customer $customer * @param Address $vatId * @param ConfigData $vatConfig * @param string $configData * @param string $customerGroup * @return array */ public function test(Customer $customer, Address $vatId, ConfigData $vatConfig, $configData, $customerGroup) { // Preconditions $this->configData = $configData; $this->customer = $customer; $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run(); $this->customer->persist(); $this->prepareVatConfig($vatConfig, $customerGroup); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run(); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($vatId); $this->customerAddressEdit->getEditForm()->saveAddress(); return ['customer' => $this->customer]; }
/** * Run Update Customer Entity test * * @param Customer $initialCustomer * @param Customer $customer * @param Address $address * @param AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage * @return void */ public function test(Customer $initialCustomer, Customer $customer, Address $address, AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage) { // Preconditions $initialCustomer->persist(); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $initialCustomer])->run(); $this->customerAccountIndex->getInfoBlock()->openEditContactInfo(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); \PHPUnit_Framework_Assert::assertThat($this->getName(), $assertCustomerInfoSuccessSavedMessage); $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); }
/** * Run Update Customer Entity test * * @param CustomerInjectable $initialCustomer * @param CustomerInjectable $customer * @param AddressInjectable $address * @param AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage * @return void */ public function test(CustomerInjectable $initialCustomer, CustomerInjectable $customer, AddressInjectable $address, AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage) { // Preconditions $initialCustomer->persist(); // Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Log In'); $this->customerAccountLogin->getLoginBlock()->fill($initialCustomer); $this->customerAccountLogin->getLoginBlock()->submit(); $this->customerAccountIndex->getInfoBlock()->openEditContactInfo(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); \PHPUnit_Framework_Assert::assertThat($this->getName(), $assertCustomerInfoSuccessSavedMessage); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); }