class MockClientStreamingCall extends ClientStreamingCall

The MockClientStreamingCall class is used to mock out the \Grpc\ClientStreamingCall class (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/ClientStreamingCall.php)

The MockClientStreamingCall object is constructed with a response object, an optional deserialize method, and an optional status. The response object and status are returned immediately from the wait() method. It also provides a write() method that accepts request objects, and a getAllRequests() method that returns all request objects passed to write(), and clears them.

Methods

__construct($response, callable|null $deserialize = null, MockStatus|null $status = null)

MockClientStreamingCall constructor.

array
wait()

Immediately return the preset response object and status.

write(Message|mixed $request, array $options = [])

Save the request object, to be retrieved via getReceivedCalls()

mixed[]
popReceivedCalls()

Return a list of calls made to write(), and clear $receivedFuncCalls.

Details

at line 59
__construct($response, callable|null $deserialize = null, MockStatus|null $status = null)

MockClientStreamingCall constructor.

Parameters

$response The response object.
callable|null $deserialize An optional deserialize method for the response object.
MockStatus|null $status An optional status object. If set to null, a status of OK is used.

at line 68
array wait()

Immediately return the preset response object and status.

Return Value

array The response object and status.

at line 80
write(Message|mixed $request, array $options = [])

Save the request object, to be retrieved via getReceivedCalls()

Parameters

Message|mixed $request The request object
array $options An array of options

Exceptions

ApiException

at line 98
mixed[] popReceivedCalls()

Return a list of calls made to write(), and clear $receivedFuncCalls.

Return Value

mixed[] An array of received requests