$transport =
$this->
createTransport(new MockHttpClient(function Dstring
$method, string
$url, array
$options) { $this->
assertSame('POST',
$method);
$this->
assertSame('https://host.test/api/v1/statuses',
$url);
$this->
assertSame('{"status":"Hello World!"}',
$options['body'
]);
$this->
assertArrayHasKey('authorization',
$options['normalized_headers'
]);
return new MockResponse('{"id":"103254962155278888"}'
);
}));
$result =
$transport->
send(new ChatMessage('Hello World!'
));
$this->
assertSame('103254962155278888',
$result->
getMessageId());
} public function testStatusWithPoll() { $transport =
$this->
createTransport(new MockHttpClient(function Dstring
$method, string
$url, array
$options) { $this->
assertSame('POST',
$method);
$this->
assertSame('https://host.test/api/v1/statuses',
$url);
$this->
assertSame('{"poll":{"options":["choice1","choice2"],"expires_in":3600},"status":"Hello World!"}',
$options['body'
]);
$this->
assertArrayHasKey('authorization',
$options['normalized_headers'
]);
return new MockResponse('{"id":"103254962155278888"}'
);
}));