From 9ab882023effd23142baeed245b16d6e816ebb37 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 15:39:05 +0100 Subject: [PATCH 01/10] add province code to output --- src/Factory/AddressBook/AddressViewFactory.php | 1 + src/View/AddressBook/AddressView.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/Factory/AddressBook/AddressViewFactory.php b/src/Factory/AddressBook/AddressViewFactory.php index 9922d683d..4e7716256 100644 --- a/src/Factory/AddressBook/AddressViewFactory.php +++ b/src/Factory/AddressBook/AddressViewFactory.php @@ -29,6 +29,7 @@ public function create(AddressInterface $address): AddressView $addressView->street = $address->getStreet(); $addressView->city = $address->getCity(); $addressView->postcode = $address->getPostcode(); + $addressView->provinceCode = $address->getProvinceCode(); $addressView->provinceName = $address->getProvinceName(); $addressView->company = $address->getCompany(); $addressView->phoneNumber = $address->getPhoneNumber(); diff --git a/src/View/AddressBook/AddressView.php b/src/View/AddressBook/AddressView.php index afbc823cb..79103bea0 100644 --- a/src/View/AddressBook/AddressView.php +++ b/src/View/AddressBook/AddressView.php @@ -24,6 +24,9 @@ class AddressView /** @var string */ public $postcode; + /** @var string */ + public $provinceCode; + /** @var string */ public $provinceName; From e1c100e32a33034764ce88314bf51513360a7dbb Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 20:19:32 +0100 Subject: [PATCH 02/10] fix one test --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index 55a16ed02..0c966a890 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,6 +29,7 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); + $address->getProvinceCode()->willReturn('GB-NWP'); $address->getProvinceName()->willReturn('Greater London'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -40,6 +41,7 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; + $addressView->provinceCode = 'GB-NWP'; $addressView->provinceName = 'Greater London'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; From df1894b46896ce9d71e1eca9db19d29eb309a390 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 20:42:41 +0100 Subject: [PATCH 03/10] add additional tests --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 4 ++-- tests/Controller/Utils/OrderPlacerTrait.php | 2 ++ .../Expected/checkout/cart_addressed_response.json | 6 ++++-- ...ith_different_shipping_and_billing_address_response.json | 6 ++++-- .../checkout/cart_with_chosen_payment_response.json | 6 ++++-- .../checkout/cart_with_chosen_shipment_response.json | 6 ++++-- ...rt_with_chosen_shipment_with_per_item_rate_response.json | 6 ++++-- ...rt_with_chosen_shipment_with_per_item_rate_response.json | 6 ++++-- tests/Responses/Expected/order/order_details_response.json | 6 ++++-- tests/Responses/Expected/order/orders_list_response.json | 6 ++++-- 10 files changed, 36 insertions(+), 18 deletions(-) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index 0c966a890..ba0fd8caa 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,7 +29,7 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); - $address->getProvinceCode()->willReturn('GB-NWP'); + $address->getProvinceCode()->willReturn('GB-LND'); $address->getProvinceName()->willReturn('Greater London'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -41,7 +41,7 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; - $addressView->provinceCode = 'GB-NWP'; + $addressView->provinceCode = 'GB-LND'; $addressView->provinceName = 'Greater London'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; diff --git a/tests/Controller/Utils/OrderPlacerTrait.php b/tests/Controller/Utils/OrderPlacerTrait.php index 4ac637c9a..057ffb2fa 100644 --- a/tests/Controller/Utils/OrderPlacerTrait.php +++ b/tests/Controller/Utils/OrderPlacerTrait.php @@ -33,6 +33,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', + 'provinceCode' => 'GB-LND', ]), Address::createFromArray([ 'firstName' => 'Sherlock', 'lastName' => 'Holmes', @@ -41,6 +42,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', + 'provinceCode' => 'GB-LND', ]) )); $bus->dispatch(new ChooseShippingMethod($token, 0, 'DHL')); diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index 6ca9b34e8..19ef6c889 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, @@ -91,7 +92,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index 35a77b933..a154f4a59 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, @@ -91,7 +92,8 @@ "street": "Baker Street 21b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, + "provinceCode": "GB-LND", "company": "Detective Corp", "phoneNumber": "111" }, diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json index 966988d24..b63f078fe 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -89,7 +90,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [ { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json index 1411790ec..8c7b81c6c 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -89,7 +90,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json index 00bc405e1..bd51350e6 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -89,7 +90,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json index b0369436d..61de6be8c 100644 --- a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -89,7 +90,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/order/order_details_response.json b/tests/Responses/Expected/order/order_details_response.json index ad9123987..405403cdb 100644 --- a/tests/Responses/Expected/order/order_details_response.json +++ b/tests/Responses/Expected/order/order_details_response.json @@ -80,7 +80,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -89,7 +90,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [ { diff --git a/tests/Responses/Expected/order/orders_list_response.json b/tests/Responses/Expected/order/orders_list_response.json index b84238d9a..aaf560fb0 100644 --- a/tests/Responses/Expected/order/orders_list_response.json +++ b/tests/Responses/Expected/order/orders_list_response.json @@ -81,7 +81,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -90,7 +91,8 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London" + "provinceName": "Greater London", + "provinceCode": "GB-LND" }, "payments": [ { From 173d7faea320cdc004f83364d494b4a115efd23d Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 20:49:12 +0100 Subject: [PATCH 04/10] modify region --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 4 ++-- tests/Controller/Utils/OrderPlacerTrait.php | 4 ++-- .../Responses/Expected/checkout/cart_addressed_response.json | 4 ++-- ..._with_different_shipping_and_billing_address_response.json | 4 ++-- .../Expected/checkout/cart_with_chosen_payment_response.json | 4 ++-- .../Expected/checkout/cart_with_chosen_shipment_response.json | 4 ++-- ...cart_with_chosen_shipment_with_per_item_rate_response.json | 4 ++-- ...cart_with_chosen_shipment_with_per_item_rate_response.json | 4 ++-- tests/Responses/Expected/order/order_details_response.json | 4 ++-- tests/Responses/Expected/order/orders_list_response.json | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index ba0fd8caa..bdbe97b7f 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,7 +29,7 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); - $address->getProvinceCode()->willReturn('GB-LND'); + $address->getProvinceCode()->willReturn('GB-ENG'); $address->getProvinceName()->willReturn('Greater London'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -41,7 +41,7 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; - $addressView->provinceCode = 'GB-LND'; + $addressView->provinceCode = 'GB-ENG'; $addressView->provinceName = 'Greater London'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; diff --git a/tests/Controller/Utils/OrderPlacerTrait.php b/tests/Controller/Utils/OrderPlacerTrait.php index 057ffb2fa..63e1145c7 100644 --- a/tests/Controller/Utils/OrderPlacerTrait.php +++ b/tests/Controller/Utils/OrderPlacerTrait.php @@ -33,7 +33,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-LND', + 'provinceCode' => 'GB-ENG', ]), Address::createFromArray([ 'firstName' => 'Sherlock', 'lastName' => 'Holmes', @@ -42,7 +42,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-LND', + 'provinceCode' => 'GB-ENG', ]) )); $bus->dispatch(new ChooseShippingMethod($token, 0, 'DHL')); diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index 19ef6c889..1df9a422b 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" }, @@ -93,7 +93,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" }, diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index a154f4a59..fadabd76a 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" }, @@ -93,7 +93,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceCode": "GB-ENG", "company": "Detective Corp", "phoneNumber": "111" }, diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json index b63f078fe..cf5ae7142 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [ { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json index 8c7b81c6c..8df9288ce 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json index bd51350e6..2bfb3470b 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json index 61de6be8c..8b589a293 100644 --- a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/order/order_details_response.json b/tests/Responses/Expected/order/order_details_response.json index 405403cdb..d13cabc41 100644 --- a/tests/Responses/Expected/order/order_details_response.json +++ b/tests/Responses/Expected/order/order_details_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [ { diff --git a/tests/Responses/Expected/order/orders_list_response.json b/tests/Responses/Expected/order/orders_list_response.json index aaf560fb0..9609b7dc2 100644 --- a/tests/Responses/Expected/order/orders_list_response.json +++ b/tests/Responses/Expected/order/orders_list_response.json @@ -82,7 +82,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "billingAddress": { "firstName": "Sherlock", @@ -92,7 +92,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceCode": "GB-ENG" }, "payments": [ { From 3d11b9362c81834549913b0ac30b255f7bb733e3 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 20:51:28 +0100 Subject: [PATCH 05/10] fix expected responses --- .../Responses/Expected/checkout/cart_addressed_response.json | 4 ++-- ..._with_different_shipping_and_billing_address_response.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index 1df9a422b..a85ae75e3 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -80,7 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, + "provinceName": "Greater London", "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" @@ -92,7 +92,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, + "provinceName": "Greater London", "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index fadabd76a..2f81dc8e3 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -80,7 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, + "provinceName": "Greater London", "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" @@ -92,7 +92,7 @@ "street": "Baker Street 21b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, + "provinceName": "Greater London", "provinceCode": "GB-ENG", "company": "Detective Corp", "phoneNumber": "111" From 6e82a768c026f8ff5198ba4124c853cb1383fd3c Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 20:59:25 +0100 Subject: [PATCH 06/10] Revert "fix expected responses" This reverts commit 3d11b9362c81834549913b0ac30b255f7bb733e3. --- .../Responses/Expected/checkout/cart_addressed_response.json | 4 ++-- ..._with_different_shipping_and_billing_address_response.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index a85ae75e3..1df9a422b 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -80,7 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" @@ -92,7 +92,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index 2f81dc8e3..fadabd76a 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -80,7 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, "provinceCode": "GB-ENG", "company": "Detective Inc", "phoneNumber": "999" @@ -92,7 +92,7 @@ "street": "Baker Street 21b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", + "provinceName": "Greater London",, "provinceCode": "GB-ENG", "company": "Detective Corp", "phoneNumber": "111" From 5cd3a72a0a1889d4ccf5f942f216fcbcf37de1c9 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 21:00:01 +0100 Subject: [PATCH 07/10] Revert "modify region" This reverts commit 173d7faea320cdc004f83364d494b4a115efd23d. --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 4 ++-- tests/Controller/Utils/OrderPlacerTrait.php | 4 ++-- .../Responses/Expected/checkout/cart_addressed_response.json | 4 ++-- ..._with_different_shipping_and_billing_address_response.json | 4 ++-- .../Expected/checkout/cart_with_chosen_payment_response.json | 4 ++-- .../Expected/checkout/cart_with_chosen_shipment_response.json | 4 ++-- ...cart_with_chosen_shipment_with_per_item_rate_response.json | 4 ++-- ...cart_with_chosen_shipment_with_per_item_rate_response.json | 4 ++-- tests/Responses/Expected/order/order_details_response.json | 4 ++-- tests/Responses/Expected/order/orders_list_response.json | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index bdbe97b7f..ba0fd8caa 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,7 +29,7 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); - $address->getProvinceCode()->willReturn('GB-ENG'); + $address->getProvinceCode()->willReturn('GB-LND'); $address->getProvinceName()->willReturn('Greater London'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -41,7 +41,7 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; - $addressView->provinceCode = 'GB-ENG'; + $addressView->provinceCode = 'GB-LND'; $addressView->provinceName = 'Greater London'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; diff --git a/tests/Controller/Utils/OrderPlacerTrait.php b/tests/Controller/Utils/OrderPlacerTrait.php index 63e1145c7..057ffb2fa 100644 --- a/tests/Controller/Utils/OrderPlacerTrait.php +++ b/tests/Controller/Utils/OrderPlacerTrait.php @@ -33,7 +33,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-ENG', + 'provinceCode' => 'GB-LND', ]), Address::createFromArray([ 'firstName' => 'Sherlock', 'lastName' => 'Holmes', @@ -42,7 +42,7 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-ENG', + 'provinceCode' => 'GB-LND', ]) )); $bus->dispatch(new ChooseShippingMethod($token, 0, 'DHL')); diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index 1df9a422b..19ef6c889 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-ENG", + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, @@ -93,7 +93,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-ENG", + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index fadabd76a..a154f4a59 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-ENG", + "provinceCode": "GB-LND", "company": "Detective Inc", "phoneNumber": "999" }, @@ -93,7 +93,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London",, - "provinceCode": "GB-ENG", + "provinceCode": "GB-LND", "company": "Detective Corp", "phoneNumber": "111" }, diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json index cf5ae7142..b63f078fe 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [ { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json index 8df9288ce..8c7b81c6c 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json index 2bfb3470b..bd51350e6 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json index 8b589a293..61de6be8c 100644 --- a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NW1", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/order/order_details_response.json b/tests/Responses/Expected/order/order_details_response.json index d13cabc41..405403cdb 100644 --- a/tests/Responses/Expected/order/order_details_response.json +++ b/tests/Responses/Expected/order/order_details_response.json @@ -81,7 +81,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -91,7 +91,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [ { diff --git a/tests/Responses/Expected/order/orders_list_response.json b/tests/Responses/Expected/order/orders_list_response.json index 9609b7dc2..aaf560fb0 100644 --- a/tests/Responses/Expected/order/orders_list_response.json +++ b/tests/Responses/Expected/order/orders_list_response.json @@ -82,7 +82,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "billingAddress": { "firstName": "Sherlock", @@ -92,7 +92,7 @@ "city": "London", "postcode": "NWB", "provinceName": "Greater London", - "provinceCode": "GB-ENG" + "provinceCode": "GB-LND" }, "payments": [ { From 2a901384d3d547530dd3735482a7b285f9689638 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 21:00:06 +0100 Subject: [PATCH 08/10] Revert "add additional tests" This reverts commit df1894b46896ce9d71e1eca9db19d29eb309a390. --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 4 ++-- tests/Controller/Utils/OrderPlacerTrait.php | 2 -- .../Expected/checkout/cart_addressed_response.json | 6 ++---- ...ith_different_shipping_and_billing_address_response.json | 6 ++---- .../checkout/cart_with_chosen_payment_response.json | 6 ++---- .../checkout/cart_with_chosen_shipment_response.json | 6 ++---- ...rt_with_chosen_shipment_with_per_item_rate_response.json | 6 ++---- ...rt_with_chosen_shipment_with_per_item_rate_response.json | 6 ++---- tests/Responses/Expected/order/order_details_response.json | 6 ++---- tests/Responses/Expected/order/orders_list_response.json | 6 ++---- 10 files changed, 18 insertions(+), 36 deletions(-) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index ba0fd8caa..0c966a890 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,7 +29,7 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); - $address->getProvinceCode()->willReturn('GB-LND'); + $address->getProvinceCode()->willReturn('GB-NWP'); $address->getProvinceName()->willReturn('Greater London'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -41,7 +41,7 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; - $addressView->provinceCode = 'GB-LND'; + $addressView->provinceCode = 'GB-NWP'; $addressView->provinceName = 'Greater London'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; diff --git a/tests/Controller/Utils/OrderPlacerTrait.php b/tests/Controller/Utils/OrderPlacerTrait.php index 057ffb2fa..4ac637c9a 100644 --- a/tests/Controller/Utils/OrderPlacerTrait.php +++ b/tests/Controller/Utils/OrderPlacerTrait.php @@ -33,7 +33,6 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-LND', ]), Address::createFromArray([ 'firstName' => 'Sherlock', 'lastName' => 'Holmes', @@ -42,7 +41,6 @@ protected function placeOrderForCustomerWithEmail(string $email, string $token): 'countryCode' => 'GB', 'postcode' => 'NWB', 'provinceName' => 'Greater London', - 'provinceCode' => 'GB-LND', ]) )); $bus->dispatch(new ChooseShippingMethod($token, 0, 'DHL')); diff --git a/tests/Responses/Expected/checkout/cart_addressed_response.json b/tests/Responses/Expected/checkout/cart_addressed_response.json index 19ef6c889..6ca9b34e8 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceName": "Greater London", "company": "Detective Inc", "phoneNumber": "999" }, @@ -92,8 +91,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceName": "Greater London", "company": "Detective Inc", "phoneNumber": "999" }, diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json index a154f4a59..35a77b933 100644 --- a/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json +++ b/tests/Responses/Expected/checkout/cart_addressed_with_different_shipping_and_billing_address_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceName": "Greater London", "company": "Detective Inc", "phoneNumber": "999" }, @@ -92,8 +91,7 @@ "street": "Baker Street 21b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London",, - "provinceCode": "GB-LND", + "provinceName": "Greater London", "company": "Detective Corp", "phoneNumber": "111" }, diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json index b63f078fe..966988d24 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_payment_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -90,8 +89,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [ { diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json index 8c7b81c6c..1411790ec 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -90,8 +89,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json index bd51350e6..00bc405e1 100644 --- a/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/cart_with_chosen_shipment_with_per_item_rate_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -90,8 +89,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json index 61de6be8c..b0369436d 100644 --- a/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json +++ b/tests/Responses/Expected/checkout/modified_cart_with_chosen_shipment_with_per_item_rate_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -90,8 +89,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NW1", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [], "shipments": [ diff --git a/tests/Responses/Expected/order/order_details_response.json b/tests/Responses/Expected/order/order_details_response.json index 405403cdb..ad9123987 100644 --- a/tests/Responses/Expected/order/order_details_response.json +++ b/tests/Responses/Expected/order/order_details_response.json @@ -80,8 +80,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -90,8 +89,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [ { diff --git a/tests/Responses/Expected/order/orders_list_response.json b/tests/Responses/Expected/order/orders_list_response.json index aaf560fb0..b84238d9a 100644 --- a/tests/Responses/Expected/order/orders_list_response.json +++ b/tests/Responses/Expected/order/orders_list_response.json @@ -81,8 +81,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "billingAddress": { "firstName": "Sherlock", @@ -91,8 +90,7 @@ "street": "Baker Street 221b", "city": "London", "postcode": "NWB", - "provinceName": "Greater London", - "provinceCode": "GB-LND" + "provinceName": "Greater London" }, "payments": [ { From a4ebfa0f4fefbc63bf86c3e1f68c0d03f21b3961 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 21:01:11 +0100 Subject: [PATCH 09/10] modify test --- spec/Factory/AddressBook/AddressViewFactorySpec.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/Factory/AddressBook/AddressViewFactorySpec.php b/spec/Factory/AddressBook/AddressViewFactorySpec.php index 0c966a890..67a41e27e 100644 --- a/spec/Factory/AddressBook/AddressViewFactorySpec.php +++ b/spec/Factory/AddressBook/AddressViewFactorySpec.php @@ -29,8 +29,8 @@ function it_creates_address_view(AddressInterface $address): void $address->getCountryCode()->willReturn('GB'); $address->getCity()->willReturn('London'); $address->getPostcode()->willReturn('NMW'); - $address->getProvinceCode()->willReturn('GB-NWP'); - $address->getProvinceName()->willReturn('Greater London'); + $address->getProvinceCode()->willReturn('GB-ENG'); + $address->getProvinceName()->willReturn('England'); $address->getCompany()->willReturn('Detective Inc'); $address->getPhoneNumber()->willReturn('999'); @@ -41,8 +41,8 @@ function it_creates_address_view(AddressInterface $address): void $addressView->countryCode = 'GB'; $addressView->city = 'London'; $addressView->postcode = 'NMW'; - $addressView->provinceCode = 'GB-NWP'; - $addressView->provinceName = 'Greater London'; + $addressView->provinceCode = 'GB-ENG'; + $addressView->provinceName = 'England'; $addressView->company = 'Detective Inc'; $addressView->phoneNumber = '999'; From 8fbcb454faef93c1e6dd0d4cf8c4f34a897757c4 Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Mon, 11 Nov 2019 21:10:11 +0100 Subject: [PATCH 10/10] add test for address view --- .../Controller/Checkout/SummarizeApiTest.php | 48 ++++++++ ...ddressed_with_province_codes_response.json | 103 ++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 tests/Responses/Expected/checkout/cart_addressed_with_province_codes_response.json diff --git a/tests/Controller/Checkout/SummarizeApiTest.php b/tests/Controller/Checkout/SummarizeApiTest.php index e4857b483..5ef0076bf 100644 --- a/tests/Controller/Checkout/SummarizeApiTest.php +++ b/tests/Controller/Checkout/SummarizeApiTest.php @@ -54,6 +54,54 @@ public function it_shows_an_order_with_same_shipping_and_billing_address_with_pr $this->assertResponse($response, 'checkout/cart_addressed_response', Response::HTTP_OK); } + /** + * @test + */ + public function it_shows_an_order_addressed_with_province_codes(): void + { + $this->loadFixturesFromFiles(['shop.yml', 'country.yml']); + + $token = 'SDAOSLEFNWU35H3QLI5325'; + + /** @var MessageBusInterface $bus */ + $bus = $this->get('sylius_shop_api_plugin.command_bus'); + $bus->dispatch(new PickupCart($token, 'WEB_GB')); + $bus->dispatch(new PutSimpleItemToCart($token, 'LOGAN_MUG_CODE', 5)); + + $data = + <<client->request('PUT', sprintf('/shop-api/checkout/%s/address', $token), [], [], static::CONTENT_TYPE_HEADER, $data); + + $response = $this->summarize($token); + $this->assertResponse($response, 'checkout/cart_addressed_with_province_codes_response', Response::HTTP_OK); + } + /** * @test */ diff --git a/tests/Responses/Expected/checkout/cart_addressed_with_province_codes_response.json b/tests/Responses/Expected/checkout/cart_addressed_with_province_codes_response.json new file mode 100644 index 000000000..9365779b3 --- /dev/null +++ b/tests/Responses/Expected/checkout/cart_addressed_with_province_codes_response.json @@ -0,0 +1,103 @@ +{ + "tokenValue": "SDAOSLEFNWU35H3QLI5325", + "channel": "WEB_GB", + "currency": "GBP", + "locale": "en_GB", + "checkoutState": "addressed", + "items": [ + { + "id": @integer@, + "quantity": 5, + "total": 9995, + "product": { + "code": "LOGAN_MUG_CODE", + "name": "Logan Mug", + "slug": "logan-mug", + "channelCode": "WEB_GB", + "description": "Some description Lorem ipsum dolor sit amet.", + "averageRating": 0, + "taxons": { + "main": "MUG", + "others": [ + "MUG", + "BRAND" + ] + }, + "variants": [ + { + "code": "LOGAN_MUG_CODE", + "name": "Logan Mug", + "axis": [], + "nameAxis": {}, + "price": { + "current": 1999, + "currency": "GBP" + }, + "originalPrice": { + "current": 2999, + "currency": "GBP" + }, + "images": [] + } + ], + "attributes": [ + { + "code": "MUG_MATERIAL_CODE", + "name": "Mug material", + "type": "select", + "value": [ + "Wood" + ] + } + ], + "associations": [], + "images": [ + { + "code": "thumbnail", + "path": "/pants.jpeg", + "cachedPath": "http://localhost/media/cache/sylius_shop_api/pants.jpeg" + } + ], + "_links": { + "self": { + "href": "\/shop-api\/products\/by-slug\/logan-mug" + } + } + } + } + ], + "totals": { + "total": 9995, + "items": 9995, + "taxes": 0, + "shipping": 0, + "promotion": 0 + }, + "shippingAddress": { + "firstName": "Sherlock", + "lastName": "Holmes", + "countryCode": "GB", + "street": "Baker Street 221b", + "city": "London", + "postcode": "NW1", + "provinceName": "England", + "provinceCode": "GB-ENG", + "company": "Detective Inc", + "phoneNumber": "999" + }, + "billingAddress": { + "firstName": "Sherlock", + "lastName": "Holmes", + "countryCode": "GB", + "street": "Baker Street 221b", + "city": "London", + "postcode": "NW1", + "provinceName": "Wales", + "provinceCode": "GB-WLS", + "company": "Detective Inc", + "phoneNumber": "999" + }, + "payments": [], + "shipments": [], + "cartDiscounts": [] +}