Skip to content
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

magento/magento2#: GraphQL. Mutation: sendEmailToFriend. Test coverage for “Please provide Email of sender.” #28034

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public function testSendFriendDisableAsCustomer()
public function testSendWithoutExistProduct()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.');
$this->expectExceptionMessage(
'The product that was requested doesn\'t exist. Verify the product and try again.'
);

$productId = 2018;
$recipients = '{
Expand Down Expand Up @@ -290,81 +292,124 @@ public function testSendProductWithoutVisibility()
/**
* @return array
*/
public function sendFriendsErrorsDataProvider()
public function sendFriendsErrorsDataProvider(): array
{
return array_merge(
$this->getRecipientErrors(),
$this->getSenderErrors()
);
}

/**
* @return array
*/
private function getRecipientErrors(): array
{
return [
[
'product_id: 1
sender: {
name: "Name"
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: ""
email:"recipient1@mail.com"
},
{
name: ""
email:"recipient2@mail.com"
}
]', 'Please provide Name for all of recipients.'
'product_id: 1
sender: {
name: "Name"
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: ""
email:"recipient1@mail.com"
},
{
name: ""
email:"recipient2@mail.com"
}
]',
'Please provide Name for all of recipients.'
],
[
'product_id: 1
sender: {
name: "Name"
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: "Recipient Name 1"
email:""
},
{
name: "Recipient Name 2"
email:""
}
]', 'Please provide Email for all of recipients.'
sender: {
name: "Name"
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: "Recipient Name 1"
email:""
},
{
name: "Recipient Name 2"
email:""
}
]',
'Please provide Email for all of recipients.'
],
];
}

/**
* @return array
*/
private function getSenderErrors(): array
{
return [
[
'product_id: 1
sender: {
name: ""
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: "Recipient Name 1"
email:"recipient1@mail.com"
},
{
name: "Recipient Name 2"
email:"recipient2@mail.com"
}
]',
'Please provide Name of sender.'
],
[
'product_id: 1
sender: {
name: ""
email: "e@mail.com"
message: "Lorem Ipsum"
}
recipients: [
{
name: "Recipient Name 1"
email:"recipient1@mail.com"
},
{
name: "Recipient Name 2"
email:"recipient2@mail.com"
}
]', 'Please provide Name of sender.'
sender: {
name: "Name"
email: ""
message: "Lorem Ipsum"
}
recipients: [
{
name: "Recipient Name 1"
email:"recipient1@mail.com"
},
{
name: "Recipient Name 2"
email:"recipient2@mail.com"
}
]',
'Please provide Email of sender.'
],
[
'product_id: 1
sender: {
name: "Name"
email: "e@mail.com"
message: ""
}
recipients: [
{
name: "Recipient Name 1"
email:"recipient1@mail.com"
},
{
name: "Recipient Name 2"
email:"recipient2@mail.com"
}
]', 'Please provide Message.'
]
sender: {
name: "Name"
email: "e@mail.com"
message: ""
}
recipients: [
{
name: "Recipient Name 1"
email:"recipient1@mail.com"
},
{
name: "Recipient Name 2"
email:"recipient2@mail.com"
}
]',
'Please provide Message.'
],
];
}

Expand Down