$this->
assertArrayHasKey('Headers',
$payload);
$this->
assertCount(1,
$payload['Headers'
]);
$this->
assertEquals(['Name' => 'foo', 'Value' => 'bar'
],
$payload['Headers'
][0
]);
} public function testSend() { $client =
new MockHttpClient(function Dstring
$method, string
$url, array
$options): ResponseInterface
{ $this->
assertSame('POST',
$method);
$this->
assertSame('https://app.mailpace.com/api/v1/send',
$url);
$this->
assertStringContainsStringIgnoringCase('MailPace-Server-Token: KEY',
$options['headers'
][1
] ??
$options['request_headers'
][1
]);
$body =
json_decode($options['body'
], true
);
$this->
assertSame('"Fabien" <fabpot@symfony.com>',
$body['from'
]);
$this->
assertSame('"Saif Eddin" <saif.gmati@symfony.com>',
$body['to'
]);
$this->
assertSame('Hello!',
$body['subject'
]);
$this->
assertSame('Hello There!',
$body['textbody'
]);
return new MockResponse(json_encode(['id' => 'foobar', 'status' => 'pending'
]),
[ 'http_code' => 200,
]);
});