12 use Magento\Checkout\Test\Page\CheckoutCart;
81 $this->customer =
$order->getDataFieldConfig(
'customer_id')[
'source']->getCustomer();
82 $this->objectManager->create(
83 \
Magento\Config\Test\TestStep\SetupConfigurationStep::class,
84 [
'configData' => $this->configData]
89 $this->prepareVatConfiguration($vatConfig);
90 $this->prepareCustomer($customerGroup);
93 $cart = $this->fixtureFactory->createByCode(
95 [
'data' => array_merge(
$cart->getData(), [
'items' => [
'products' =>
$products]])]
97 $address = $this->customer->getDataFieldConfig(
'address')[
'source']->getAddresses()[0];
100 $this->updateCustomer($customerGroup);
103 $this->objectManager->create(
104 \
Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
105 [
'customer' => $this->customer]
107 $this->objectManager->create(
108 \
Magento\Checkout\Test\TestStep\AddProductsToTheCartStep::class,
111 $this->checkoutCart->open();
112 $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
113 $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax(
$address);
114 $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
119 'orderId' =>
$order->getId(),
131 private function prepareVatConfiguration($vatConfig)
134 'customer/create_account/viv_domestic_group' => [
135 'value' => $this->vatGroups[
'valid_domestic_group']->getCustomerGroupId()
137 'customer/create_account/viv_intra_union_group' => [
138 'value' => $this->vatGroups[
'valid_intra_union_group']->getCustomerGroupId()
140 'customer/create_account/viv_invalid_group' => [
141 'value' => $this->vatGroups[
'invalid_group']->getCustomerGroupId()
143 'customer/create_account/viv_error_group' => [
144 'value' => $this->vatGroups[
'error_group']->getCustomerGroupId()
147 $vatConfig = $this->fixtureFactory->createByCode(
149 [
'data' => array_replace_recursive($vatConfig->getSection(), $groupConfig)]
151 $vatConfig->persist();
160 private function prepareCustomer($customerGroup)
163 $this->customer->getData(),
164 [
'group_id' => [
'value' => $this->vatGroups[$customerGroup]->getCustomerGroupId()]],
165 [
'address' => [
'addresses' => $this->customer->getDataFieldConfig(
'address')[
'source']->getAddresses()]],
166 [
'email' =>
'JohnDoe%isolation%@example.com']
170 $this->customer = $this->fixtureFactory->createByCode(
'customer', [
'data' =>
$customerData]);
171 $this->customer->persist();
180 private function updateCustomer($customerGroup)
183 $this->customer->getData(),
184 [
'group_id' => [
'value' => $this->vatGroups[$customerGroup]->getCustomerGroupCode()]]
187 $this->customer = $this->fixtureFactory->createByCode(
'customer', [
'data' =>
$customerData]);
198 $this->objectManager->create(\
Magento\Tax\Test\TestStep\DeleteAllTaxRulesStep::class)->run();
test(ConfigData $vatConfig, OrderInjectable $order, TaxRule $taxRule, Cart $cart, $configData, $customerGroup)
__inject(CheckoutCart $checkoutCart)