From 984ef45dde306f67c13f3ea4ce39039e557a3837 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Wed, 18 Sep 2019 15:15:24 +0300 Subject: [PATCH 1/5] graphQl-912: optimized customer input schema --- app/code/Magento/CustomerGraphQl/etc/schema.graphqls | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls index d27debdc39c6..90d032be5b1e 100644 --- a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls @@ -60,10 +60,10 @@ input CustomerInput { middlename: String @doc(description: "The customer's middle name") lastname: String @doc(description: "The customer's family name") suffix: String @doc(description: "A value such as Sr., Jr., or III") - email: String @doc(description: "The customer's email address. Required") + email: String! @doc(description: "The customer's email address. Required") dob: String @doc(description: "The customer's date of birth") - taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - gender: Int @doc(description: "The customer's gender(Male - 1, Female - 2)") + taxvat: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") + gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") } @@ -88,11 +88,11 @@ type Customer @doc(description: "Customer defines the customer name and address default_billing: String @doc(description: "The ID assigned to the billing address") default_shipping: String @doc(description: "The ID assigned to the shipping address") dob: String @doc(description: "The customer's date of birth") - taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") + taxvat: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") id: Int @doc(description: "The ID assigned to the customer") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\IsSubscribed") addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CustomerAddresses") - gender: Int @doc(description: "The customer's gender(Male - 1, Female - 2)") + gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") } type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){ @@ -112,7 +112,7 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform middlename: String @doc(description: "The middle name of the person associated with the shipping/billing address") prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") - vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") + vat_id: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") custom_attributes: [CustomerAddressAttribute] @doc(description: "Address custom attributes") From 8247d578c633ee7fa2df63a6af937e0aa81a4f30 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 27 Sep 2019 10:16:43 +0300 Subject: [PATCH 2/5] graphQl-912: fixing api functional test --- .../Magento/GraphQl/Customer/CreateCustomerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php index 5b3ff041d481..1b28b1639d77 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php @@ -114,7 +114,7 @@ public function testCreateCustomerAccountWithoutPassword() /** * @expectedException \Exception - * @expectedExceptionMessage "input" value should be specified + * @expectedExceptionMessage Field CustomerInput.email of required type String! was not provided */ public function testCreateCustomerIfInputDataIsEmpty() { @@ -140,7 +140,7 @@ public function testCreateCustomerIfInputDataIsEmpty() /** * @expectedException \Exception - * @expectedExceptionMessage Required parameters are missing: Email + * @expectedExceptionMessage GraphQL response contains errors: Field CustomerInput.email of required type String! was not provided */ public function testCreateCustomerIfEmailMissed() { @@ -275,7 +275,7 @@ public function testCreateCustomerIfNameEmpty() QUERY; $this->graphQlMutation($query); } - + /** * @magentoConfigFixture default_store newsletter/general/active 0 */ From f9ff771264c854223bc931c4567e391c17fd0e13 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 27 Sep 2019 11:02:26 +0300 Subject: [PATCH 3/5] graphQl-912: fixed static tests --- .../testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php index 1b28b1639d77..7c86ebeaa363 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php @@ -140,7 +140,8 @@ public function testCreateCustomerIfInputDataIsEmpty() /** * @expectedException \Exception - * @expectedExceptionMessage GraphQL response contains errors: Field CustomerInput.email of required type String! was not provided + * @expectedExceptionMessage + * GraphQL response contains errors: Field CustomerInput.email of required type String! was not provided */ public function testCreateCustomerIfEmailMissed() { From 30e8127e1f63e7e1fc67eea90d16c289c613c71b Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 27 Sep 2019 11:06:46 +0300 Subject: [PATCH 4/5] graphQl-912: removed redundant check --- .../testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php index 7c86ebeaa363..7ef86a120882 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php @@ -140,8 +140,6 @@ public function testCreateCustomerIfInputDataIsEmpty() /** * @expectedException \Exception - * @expectedExceptionMessage - * GraphQL response contains errors: Field CustomerInput.email of required type String! was not provided */ public function testCreateCustomerIfEmailMissed() { From be95cfa563f30a94db9e517c16ee921afa91e2bc Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 27 Sep 2019 11:07:42 +0300 Subject: [PATCH 5/5] graphQl-912: fixed expectedExceptionMessage --- .../testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php index 7ef86a120882..0be968d6d340 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php @@ -140,6 +140,7 @@ public function testCreateCustomerIfInputDataIsEmpty() /** * @expectedException \Exception + * @expectedExceptionMessage Field CustomerInput.email of required type String! was not provided */ public function testCreateCustomerIfEmailMissed() {