Skip to content

Commit

Permalink
LYNX-161: Add api-functional test to ensure static attributes values …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
bl4de authored Jul 19, 2023
1 parent bb53584 commit 9bc508b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public function testChangePassword()
$response = $this->graphQlMutation($query, [], '', $headerMap);
$this->assertEquals($customerEmail, $response['changeCustomerPassword']['email']);

$this->assertEmpty(
$response['changeCustomerPassword']['custom_attributes'],
'custom_attributes should not contain any static values'
);

try {
// registry contains the old password hash so needs to be reset
$this->customerRegistry->removeByEmail($customerEmail);
Expand Down Expand Up @@ -216,6 +221,18 @@ private function getQuery($currentPassword, $newPassword)
email
firstname
lastname
custom_attributes {
code
... on AttributeValue {
value
}
... on AttributeSelectedOptions {
selected_options {
value
label
}
}
}
}
}
QUERY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,43 +225,43 @@ public function testCreateCustomerAddressWithCustomAttributesV2()
$this->assertEquals(
[
'createCustomerAddress' =>
[
'region' => [
'region' => 'Arizona',
'region_code' => 'AZ'
],
'country_code' => 'US',
'street' => [
'123 Main Street'
],
'telephone' => '7777777777',
'postcode' => '77777',
'city' => 'Phoenix',
'default_shipping' => true,
'default_billing' => false,
'custom_attributesV2' =>
[
'region' => [
'region' => 'Arizona',
'region_code' => 'AZ'
],
'country_code' => 'US',
'street' => [
'123 Main Street'
0 =>
[
'code' => $this->multiselect_attribute->getAttributeCode(),
'selected_options' => [
[
'label' => $this->option3->getLabel(),
'value' => $this->option3->getValue()
],
[
'label' => $this->option2->getLabel(),
'value' => $this->option2->getValue()
]
]
],
'telephone' => '7777777777',
'postcode' => '77777',
'city' => 'Phoenix',
'default_shipping' => true,
'default_billing' => false,
'custom_attributesV2' =>
[
0 =>
[
'code' => $this->multiselect_attribute->getAttributeCode(),
'selected_options' => [
[
'label' => $this->option3->getLabel(),
'value' => $this->option3->getValue()
],
[
'label' => $this->option2->getLabel(),
'value' => $this->option2->getValue()
]
]
],
1 =>
[
'code' => $this->simple_attribute->getAttributeCode(),
'value' => 'brand new customer address value'
]
],
1 =>
[
'code' => $this->simple_attribute->getAttributeCode(),
'value' => 'brand new customer address value'
]
],
],
],
$response
);
Expand Down

0 comments on commit 9bc508b

Please sign in to comment.