-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL GiftMessageGraphQl add coverage for cart #27956
Conversation
Hi @Usik2203. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Usik2203. Thank you for your collaboration. Please, check my comments, adjust the code style and you may proceed with the test coverage.
Thank you!
$giftCartMessage = $this->cartRepository->get($cart->getId()); | ||
|
||
return [ | ||
'to' => $giftCartMessage->getRecipient(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recipient
, sender
and message
may have null
value. In this case, we need to make sure that we have no exception because all 3 values are required (and have Sring
type) in the schema. I would recommend using the null coalesce operator and return empty string in case of no value. i.e.
$giftCartMessage->getSender() ?? ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"magento/module-backend": "*", | ||
"magento/module-catalog": "*", | ||
"magento/module-checkout": "*", | ||
"magento/module-customer": "*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure that we need all these dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/** | ||
* Class GiftMessageItem | ||
*/ | ||
class GiftMessageItem implements ResolverInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should extend this PR with more functionality. Let's leave the gift messages for different cart item types in this PR and cover all other functionality (mutations, gift wrapping) in the following PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed it from this PR, will do it in other PR
@rogyar api-functional test was added for this PR. |
@magento run Static Tests |
@magento run Magento Health Index |
@magento run Static Tests |
1 similar comment
@magento run Static Tests |
Hi @rogyar, thank you for the review. |
Verified that no new |
✔️ QA Passed The GraphQL query query {
cart(
cart_id: "8T3x445Ys2Scga6yWHAGVP9GYUPR8ua2"
) {
gift_message {
from
message
to
}
}
} returns {
"data": {
"cart": {
"gift_message": {
"from": "From",
"message": "Message",
"to": "To"
}
}
}
} |
Hi @Usik2203, thank you for your contribution! |
Description (*)
This PR extends the existing GraphQl coverage by adding information about gift message to different types of cart items.
Please note, this PR does not cover the entire gift wrapping functionality but resolvers for the gift message. The rest of the git wrapping functionality will be delivered with the others PR
Note: These types were not extended because these types are not declared
This PR was mentioned for fixing failed static test related with composer.json file
#253
Related Pull Requests
#28072
#28105
Fixed Issues (if relevant)
Manual testing scenarios (*)
You can use this query for manual testing. You should take
maskedQuoteId
fromquote_id_mask
table