@@ -164,28 +164,25 @@ private function assertCustomerAddressesFields(AddressInterface $address, $actua
164164 }
165165
166166 /**
167- * Update address with invalid ID
167+ * Update address with missing ID input.
168168 *
169169 * @magentoApiDataFixture Magento/Customer/_files/customer.php
170170 * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
171171 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
172- * @dataProvider invalidIdDataProvider
173- * @param string $addressId
174- * @param $exceptionMessage
175172 */
176- public function testCreateCustomerAddressWithInvalidId ( $ addressId , $ exceptionMessage )
173+ public function testUpdateCustomerAddressWithMissingId ( )
177174 {
178175179176 $ password = 'password ' ;
180177
181178 $ updateAddress = $ this ->getAddressData ();
182- $ defaultShippingText = $ updateAddress ['default_shipping ' ] ? " true " : " false " ;
183- $ defaultBillingText = $ updateAddress ['default_billing ' ] ? " true " : " false " ;
179+ $ defaultShippingText = $ updateAddress ['default_shipping ' ] ? ' true ' : ' false ' ;
180+ $ defaultBillingText = $ updateAddress ['default_billing ' ] ? ' true ' : ' false ' ;
184181
185182 $ mutation
186183 = <<<MUTATION
187184mutation {
188- updateCustomerAddress( $ addressId , input: {
185+ updateCustomerAddress(, input: {
189186 region: {
190187 region: " {$ updateAddress ['region ' ]['region ' ]}"
191188 region_id: {$ updateAddress ['region ' ]['region_id ' ]}
@@ -212,17 +209,76 @@ public function testCreateCustomerAddressWithInvalidId($addressId, $exceptionMes
212209}
213210MUTATION ;
214211
215- self ::expectException (Exception::class);
216- self ::expectExceptionMessage ($ exceptionMessage );
217- $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password )); }
212+ $ this ->expectException (Exception::class);
213+ $ this ->expectExceptionMessage (
214+ 'GraphQL response contains errors: Field "updateCustomerAddress" argument "id" of type "Int!" is ' .
215+ 'required but not provided. '
216+ );
217+ $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password ));
218+ }
219+
220+ /**
221+ * Update address with invalid ID input.
222+ *
223+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
224+ * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
225+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
226+ */
227+ public function testUpdateCustomerAddressWithInvalidIdType ()
228+ {
229+ $ this ->markTestSkipped (
230+ 'Type validation returns wrong message https://github.com/magento/graphql-ce/issues/735 '
231+ );
232+ 233+ $ password = 'password ' ;
234+
235+ $ updateAddress = $ this ->getAddressData ();
236+ $ defaultShippingText = $ updateAddress ['default_shipping ' ] ? 'true ' : 'false ' ;
237+ $ defaultBillingText = $ updateAddress ['default_billing ' ] ? 'true ' : 'false ' ;
238+
239+ $ mutation
240+ = <<<MUTATION
241+ mutation {
242+ updateCustomerAddress(id: "", input: {
243+ region: {
244+ region: " {$ updateAddress ['region ' ]['region ' ]}"
245+ region_id: {$ updateAddress ['region ' ]['region_id ' ]}
246+ region_code: " {$ updateAddress ['region ' ]['region_code ' ]}"
247+ }
248+ country_id: {$ updateAddress ['country_id ' ]}
249+ street: [" {$ updateAddress ['street ' ][0 ]}"," {$ updateAddress ['street ' ][1 ]}"]
250+ company: " {$ updateAddress ['company ' ]}"
251+ telephone: " {$ updateAddress ['telephone ' ]}"
252+ fax: " {$ updateAddress ['fax ' ]}"
253+ postcode: " {$ updateAddress ['postcode ' ]}"
254+ city: " {$ updateAddress ['city ' ]}"
255+ firstname: " {$ updateAddress ['firstname ' ]}"
256+ lastname: " {$ updateAddress ['lastname ' ]}"
257+ middlename: " {$ updateAddress ['middlename ' ]}"
258+ prefix: " {$ updateAddress ['prefix ' ]}"
259+ suffix: " {$ updateAddress ['suffix ' ]}"
260+ vat_id: " {$ updateAddress ['vat_id ' ]}"
261+ default_shipping: {$ defaultShippingText }
262+ default_billing: {$ defaultBillingText }
263+ }) {
264+ id
265+ }
266+ }
267+ MUTATION ;
268+
269+ $ this ->expectException (Exception::class);
270+ $ this ->expectExceptionMessage ('Expected type Int!, found "" ' );
271+ $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password ));
272+ }
218273
219274 /**
220275 * @return array
221276 */
222277 public function invalidIdDataProvider ()
223278 {
224279 return [
225- ['' , 'GraphQL response contains errors: Field "updateCustomerAddress" argument "id" of type "Int!" is required but not provided. ' ],
280+ ['' , 'GraphQL response contains errors: Field "updateCustomerAddress" argument "id" of type "Int!" ' .
281+ 'is required but not provided. ' ],
226282 //TODO: why here the internal server error being trowed?
227283 ['id: "" ' , 'GraphQL response contains errors: Internal server error ' ]
228284 ];
@@ -235,9 +291,9 @@ public function invalidIdDataProvider()
235291 * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
236292 * @dataProvider invalidInputDataProvider
237293 * @param string $input
238- * @param $exceptionMessage
294+ * @param string $exceptionMessage
239295 */
240- public function testUpdateCustomerAddressWithInvalidInput ($ input , $ exceptionMessage )
296+ public function testUpdateCustomerAddressWithInvalidInput (string $ input , string $ exceptionMessage )
241297 {
242298243299 $ password = 'password ' ;
@@ -252,9 +308,10 @@ public function testUpdateCustomerAddressWithInvalidInput($input, $exceptionMess
252308}
253309MUTATION ;
254310
255- self ::expectException (Exception::class);
256- self ::expectExceptionMessage ($ exceptionMessage );
257- $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password )); }
311+ $ this ->expectException (Exception::class);
312+ $ this ->expectExceptionMessage ($ exceptionMessage );
313+ $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password ));
314+ }
258315
259316 /**
260317 * @return array
@@ -282,14 +339,14 @@ public function testUpdateNotExistingCustomerAddress()
282339
283340 $ mutation = $ this ->getMutation ($ addressId );
284341
285- $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password ));
342+ $ this ->graphQlMutation ($ mutation , [], '' , $ this ->getCustomerAuthHeaders ($ userName , $ password ));
286343 }
287344
288345 /**
289346 * @magentoApiDataFixture Magento/Customer/_files/two_customers.php
290347 * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
291348 * @expectedException Exception
292- * @expectedExceptionMessage GraphQL response contains errors: Current customer does not have permission to address with ID "1"
349+ * @expectedExceptionMessage Current customer does not have permission to address with ID "1"
293350 */
294351 public function testUpdateAnotherCustomerAddress ()
295352 {
@@ -307,7 +364,7 @@ public function testUpdateAnotherCustomerAddress()
307364 * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
308365 * @magentoApiDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php
309366 * @expectedException Exception
310- * @expectedExceptionMessage The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.
367+ * @expectedExceptionMessage The account sign-in was incorrect or your account is disabled temporarily.
311368 */
312369 public function testUpdateCustomerAddressIfAccountIsNotConfirmed ()
313370 {
@@ -324,7 +381,7 @@ public function testUpdateCustomerAddressIfAccountIsNotConfirmed()
324381 * @magentoApiDataFixture Magento/Customer/_files/customer.php
325382 * @magentoApiDataFixture Magento/Customer/_files/customer_address.php
326383 * @expectedException Exception
327- * @expectedExceptionMessage GraphQL response contains errors: The account is locked.
384+ * @expectedExceptionMessage The account is locked.
328385 */
329386 public function testUpdateCustomerAddressIfAccountIsLocked ()
330387 {
0 commit comments