Skip to content

Commit

Permalink
ENGCOM-3956: Fix region_id update in updateCustomerAddress mutation #312
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav authored Jan 24, 2019
2 parents 1fd2493 + 37bcc56 commit 208ffaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ private function updateCustomerAddress(int $customerId, int $addressId, array $a
{
$address = $this->getCustomerAddressForUser->execute($addressId, $customerId);
$this->dataObjectHelper->populateWithArray($address, $addressData, AddressInterface::class);
if (isset($addressData['region']['region_id'])) {
$address->setRegionId($address->getRegion()->getRegionId());
}

return $this->addressRepository->save($address);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,12 @@ private function assertCustomerAddressesFields(AddressInterface $address, $actua
];
$this->assertResponseFields($actualResponse, $assertionMap);
$this->assertTrue(is_array([$actualResponse['region']]), "region field must be of an array type.");
// https://github.com/magento/graphql-ce/issues/270
// $assertionRegionMap = [
// ['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()],
// ['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()],
// ['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()]
// ];
// $this->assertResponseFields($actualResponse['region'], $assertionRegionMap);
$assertionRegionMap = [
['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()],
['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()],
['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()]
];
$this->assertResponseFields($actualResponse['region'], $assertionRegionMap);
}

/**
Expand Down

0 comments on commit 208ffaa

Please sign in to comment.