Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 891e5a4

Browse files
committed
#1029: Add Postcode as required depending of the country Mutation createCustomerAddress
- added test
1 parent 127835e commit 891e5a4

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php

+61
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,67 @@ public function testCreateCustomerAddressWithRedundantStreetLine()
358358
$this->graphQlMutation($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password));
359359
}
360360

361+
/**
362+
* @magentoApiDataFixture Magento/Customer/_files/customer_without_addresses.php
363+
* @magentoConfigFixture default_store general/country/optional_zip_countries UA
364+
*
365+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
366+
*/
367+
public function testCreateCustomerAddressWithOptionalZipCode()
368+
{
369+
$newAddress = [
370+
'country_code' => 'UA',
371+
'street' => ['Line 1 Street', 'Line 2'],
372+
'company' => 'Company name',
373+
'telephone' => '123456789',
374+
'fax' => '123123123',
375+
'city' => 'City Name',
376+
'firstname' => 'Adam',
377+
'lastname' => 'Phillis',
378+
'middlename' => 'A',
379+
'prefix' => 'Mr.',
380+
'suffix' => 'Jr.',
381+
'vat_id' => '1',
382+
'default_shipping' => true,
383+
'default_billing' => false
384+
];
385+
386+
$mutation
387+
= <<<MUTATION
388+
mutation {
389+
createCustomerAddress(input: {
390+
country_code: {$newAddress['country_code']}
391+
street: ["{$newAddress['street'][0]}","{$newAddress['street'][1]}"]
392+
company: "{$newAddress['company']}"
393+
telephone: "{$newAddress['telephone']}"
394+
fax: "{$newAddress['fax']}"
395+
city: "{$newAddress['city']}"
396+
firstname: "{$newAddress['firstname']}"
397+
lastname: "{$newAddress['lastname']}"
398+
middlename: "{$newAddress['middlename']}"
399+
prefix: "{$newAddress['prefix']}"
400+
suffix: "{$newAddress['suffix']}"
401+
vat_id: "{$newAddress['vat_id']}"
402+
default_shipping: true
403+
default_billing: false
404+
}) {
405+
id
406+
}
407+
}
408+
MUTATION;
409+
410+
$userName = '[email protected]';
411+
$password = 'password';
412+
413+
$response = $this->graphQlMutation(
414+
$mutation,
415+
[],
416+
'',
417+
$this->getCustomerAuthHeaders($userName, $password)
418+
);
419+
$this->assertNotEmpty($response['createCustomerAddress']['id']);
420+
}
421+
361422
/**
362423
* Create new address with invalid input
363424
*

0 commit comments

Comments
 (0)