Skip to content

Commit

Permalink
Test entire request (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse authored Mar 14, 2020
1 parent b94bfe0 commit 6c88b6a
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions tests/Unit/Input/SendEmailRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class SendEmailRequestTest extends TestCase
{
public function testRequestBody(): void
public function testRequest(): void
{
$input = new SendEmailRequest([
'FromEmailAddress' => '[email protected]',
Expand Down Expand Up @@ -43,37 +43,42 @@ public function testRequestBody(): void
]);

// see example-1.json from SDK
$expected = '{
"FromEmailAddress": "[email protected]",
"Destination": {
"ToAddresses": [
"[email protected]",
"[email protected]"
],
"CcAddresses": [
"[email protected]"
]
},
"Content": {
"Simple": {
"Subject": {
"Data": "Test email",
"Charset": "UTF-8"
},
"Body": {
"Text": {
"Data": "This is the message body in text format.",
$expected = '
POST /v2/email/outbound-emails HTTP/1.0
Content-Type: application/json
{
"FromEmailAddress": "[email protected]",
"Destination": {
"ToAddresses": [
"[email protected]",
"[email protected]"
],
"CcAddresses": [
"[email protected]"
]
},
"Content": {
"Simple": {
"Subject": {
"Data": "Test email",
"Charset": "UTF-8"
},
"Html": {
"Data": "This message body contains HTML formatting. It can, for example, contain links like this one: <a class=\\"ulink\\" href=\\"http:\\/\\/docs.aws.amazon.com\\/ses\\/latest\\/DeveloperGuide\\" target=\\"_blank\\">Amazon SES Developer Guide<\\/a>.",
"Charset": "UTF-8"
"Body": {
"Text": {
"Data": "This is the message body in text format.",
"Charset": "UTF-8"
},
"Html": {
"Data": "This message body contains HTML formatting. It can, for example, contain links like this one: <a class=\\"ulink\\" href=\\"http:\\/\\/docs.aws.amazon.com\\/ses\\/latest\\/DeveloperGuide\\" target=\\"_blank\\">Amazon SES Developer Guide<\\/a>.",
"Charset": "UTF-8"
}
}
}
}
}
}';
';

self::assertJsonStringEqualsJsonString($expected, $input->request()->getBody()->stringify());
self::assertRequestEqualsHttpRequest($expected, $input->request());
}
}

0 comments on commit 6c88b6a

Please sign in to comment.