-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[GraphQl] Gift Message coverage for customer order #28105
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] Gift Message coverage for customer order #28105
Conversation
Hi @Usik2203. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
gift_message: GiftMessage @resolver (class: "\\Magento\\GiftMessageGraphQl\\Model\\Resolver\\GiftMessage") @doc(description: "The entered gift message for the cart") | ||
} | ||
#TODO add resolver for SalesItemInterface | ||
type SalesItemInterface { |
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 @rogyar .
I confused about implementing this point.
I can't understand which GraphQl query should be for testing this one.
Maybe you could clarify it.
Thanks a lot.
/** | ||
* Class for getting GiftMessage from CustomerOrder | ||
*/ | ||
class GiftMessageCustomerOrder 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.
Currently, we have 2 different resolvers in the directory called GiftMessage
and GiftMessageCustomerOrder
.
The naming is not 100% consistent. So I would propose moving resolvers to the separate directories, so we have:
Model/Resolver/Order/GiftMessage.php
Model/Resolver/Cart/GiftMessage.php
Model/Resolver/Order/Item/GiftMessage
(in the future)
The same applies to the tests.
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 for all three PRs
Thanks
5027759
to
d727243
Compare
app/code/Magento/GiftMessageGraphQl/Model/Resolver/Order/GiftMessage.php
Outdated
Show resolved
Hide resolved
dev/tests/api-functional/testsuite/Magento/GraphQl/GiftMessage/Order/GiftMessageTest.php
Outdated
Show resolved
Hide resolved
d727243
to
ad5c6a5
Compare
@magento run all tests |
@magento run WebAPI Tests |
@magento run all tests |
Verified that no new |
✔️ QA Passed query{
customerOrders{
items{
gift_message{
from
message
to
}
}
}
}
response:
{
"data": {
"customerOrders": {
"items": [
{
"gift_message": {
"from": "User2",
"message": "Gift message",
"to": "User1"
}
}
]
}
}
} If user has two orders the response returns two messages: {
"data": {
"customerOrders": {
"items": [
{
"gift_message": {
"from": "User2",
"message": "Gift message",
"to": "User1"
}
},
{
"gift_message": {
"from": "User1",
"message": "Thank you message",
"to": "User2"
}
}
]
}
}
} If incorrect Authorization token is provided: {
"errors": [
{
"message": "The current customer isn't authorized.",
"extensions": {
"category": "graphql-authorization"
},
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"customerOrders"
]
}
],
"data": {
"customerOrders": null
}
} If there is an order but with no gift message {
"errors": [
{
"message": "Can't load gift message for order",
"extensions": {
"category": "graphql-input"
},
"locations": [
{
"line": 4,
"column": 7
}
],
"path": [
"customerOrders",
"items",
0,
"gift_message"
]
}
],
"data": {
"customerOrders": {
"items": [
{
"gift_message": null
}
]
}
}
} |
@magento run all tests |
@magento run Magento Health Index |
@magento run all tests |
Hi @Usik2203, thank you for your contribution! |
Description (*)
This PR extends PR #27956 (Parent PR)
add coverage for customer order
This PR was mentioned for fixing failed static test related with composer.json file
#253
Related Pull Requests
#27956
Fixed Issues (if relevant)
Manual testing scenarios (*)