Skip to content

Commit 9bc508b

Browse files
authored
LYNX-161: Add api-functional test to ensure static attributes values are not included in custom_attriubtes fields (#127)
* LYNX-161: Assertion 'backend_type' for createCustomerAddress mutation response * LYNX-161: Reverse changes * LYNX-161: Add api-functional test to ensure static attributes values are not included in custom_attriubtes fields * LYNX-161: Add api-functional test to ensure static attributes values are not included in custom_attriubtes fields
1 parent bb53584 commit 9bc508b

File tree

2 files changed

+51
-34
lines changed

2 files changed

+51
-34
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ public function testChangePassword()
7272
$response = $this->graphQlMutation($query, [], '', $headerMap);
7373
$this->assertEquals($customerEmail, $response['changeCustomerPassword']['email']);
7474

75+
$this->assertEmpty(
76+
$response['changeCustomerPassword']['custom_attributes'],
77+
'custom_attributes should not contain any static values'
78+
);
79+
7580
try {
7681
// registry contains the old password hash so needs to be reset
7782
$this->customerRegistry->removeByEmail($customerEmail);
@@ -216,6 +221,18 @@ private function getQuery($currentPassword, $newPassword)
216221
email
217222
firstname
218223
lastname
224+
custom_attributes {
225+
code
226+
... on AttributeValue {
227+
value
228+
}
229+
... on AttributeSelectedOptions {
230+
selected_options {
231+
value
232+
label
233+
}
234+
}
235+
}
219236
}
220237
}
221238
QUERY;

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

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -225,43 +225,43 @@ public function testCreateCustomerAddressWithCustomAttributesV2()
225225
$this->assertEquals(
226226
[
227227
'createCustomerAddress' =>
228+
[
229+
'region' => [
230+
'region' => 'Arizona',
231+
'region_code' => 'AZ'
232+
],
233+
'country_code' => 'US',
234+
'street' => [
235+
'123 Main Street'
236+
],
237+
'telephone' => '7777777777',
238+
'postcode' => '77777',
239+
'city' => 'Phoenix',
240+
'default_shipping' => true,
241+
'default_billing' => false,
242+
'custom_attributesV2' =>
228243
[
229-
'region' => [
230-
'region' => 'Arizona',
231-
'region_code' => 'AZ'
232-
],
233-
'country_code' => 'US',
234-
'street' => [
235-
'123 Main Street'
244+
0 =>
245+
[
246+
'code' => $this->multiselect_attribute->getAttributeCode(),
247+
'selected_options' => [
248+
[
249+
'label' => $this->option3->getLabel(),
250+
'value' => $this->option3->getValue()
251+
],
252+
[
253+
'label' => $this->option2->getLabel(),
254+
'value' => $this->option2->getValue()
255+
]
256+
]
236257
],
237-
'telephone' => '7777777777',
238-
'postcode' => '77777',
239-
'city' => 'Phoenix',
240-
'default_shipping' => true,
241-
'default_billing' => false,
242-
'custom_attributesV2' =>
243-
[
244-
0 =>
245-
[
246-
'code' => $this->multiselect_attribute->getAttributeCode(),
247-
'selected_options' => [
248-
[
249-
'label' => $this->option3->getLabel(),
250-
'value' => $this->option3->getValue()
251-
],
252-
[
253-
'label' => $this->option2->getLabel(),
254-
'value' => $this->option2->getValue()
255-
]
256-
]
257-
],
258-
1 =>
259-
[
260-
'code' => $this->simple_attribute->getAttributeCode(),
261-
'value' => 'brand new customer address value'
262-
]
263-
],
258+
1 =>
259+
[
260+
'code' => $this->simple_attribute->getAttributeCode(),
261+
'value' => 'brand new customer address value'
262+
]
264263
],
264+
],
265265
],
266266
$response
267267
);

0 commit comments

Comments
 (0)