public function testSuccessfulPing() { $client =
new MockHttpClient([ function D
$method,
$url) { $this->
assertSame('POST',
$method);
$this->
assertSame('https://endpoint.com/key',
$url);
return new MockResponse('a response'
);
},
]);
$handler =
new PingWebhookMessageHandler($client);
$response =
$handler(new PingWebhookMessage('POST', 'https://endpoint.com/key'
));
$this->
assertSame(200,
$response->
getStatusCode());
$this->
assertSame('a response',
$response->
getContent());
$this->
assertSame('https://endpoint.com/key',
$response->
getInfo('url'
));
} public function testPingErrorThrowsException() { $client =
new MockHttpClient([ function D
$method,
$url) { $this->
assertSame('POST',
$method);