@@ -134,6 +134,68 @@ public function testSetNewBillingAddress()
134134 $ this ->assertNewAddressFields ($ billingAddressResponse );
135135 }
136136
137+ /**
138+ * Tests setting the billing address on a guest's cart by providing new address input information.
139+ *
140+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
141+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
142+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
143+ */
144+ public function testSetNewBillingAddressOnGuest ()
145+ {
146+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
147+
148+ $ query = <<<QUERY
149+ mutation {
150+ setBillingAddressOnCart(
151+ input: {
152+ cart_id: " $ maskedQuoteId"
153+ billing_address: {
154+ address: {
155+ firstname: "test firstname"
156+ lastname: "test lastname"
157+ company: "test company"
158+ street: ["test street 1", "test street 2"]
159+ city: "test city"
160+ region: "AZ"
161+ postcode: "887766"
162+ country_code: "US"
163+ telephone: "88776655"
164+ vat_id: "DE313215027"
165+ }
166+ }
167+ }
168+ ) {
169+ cart {
170+ billing_address {
171+ firstname
172+ lastname
173+ company
174+ street
175+ city
176+ postcode
177+ telephone
178+ vat_id
179+ country {
180+ code
181+ label
182+ }
183+ __typename
184+ }
185+ }
186+ }
187+ }
188+ QUERY ;
189+ $ response = $ this ->graphQlMutation ($ query , [], '' );
190+
191+ self ::assertArrayHasKey ('cart ' , $ response ['setBillingAddressOnCart ' ]);
192+ $ cartResponse = $ response ['setBillingAddressOnCart ' ]['cart ' ];
193+ self ::assertArrayHasKey ('billing_address ' , $ cartResponse );
194+ $ billingAddressResponse = $ cartResponse ['billing_address ' ];
195+ self ::assertArrayHasKey ('vat_id ' , $ billingAddressResponse );
196+ $ this ->assertNewAddressFields ($ billingAddressResponse );
197+ }
198+
137199 /**
138200 * Tests that the "use_for_shipping" option sets the provided billing address for shipping as well.
139201 *
0 commit comments