Copied!

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.

  • internal
CloneableInstantiable
  • Extends
    Grpc\AbstractCall
    Grpc\ClientStreamingCall
Methods
public __construct( $response, $deserialize = NULL, ?stdClass $status = NULL)
 

MockClientStreamingCall constructor.

  • param \Message|string $response The response object.
  • param callable|array|null $deserialize An optional deserialize method for the response object.
  • param \stdClass|null $status An optional status object. If set to null, a status of OK is used.
public Grpc\AbstractCall::cancel()
 

Cancels the call.

public Grpc\AbstractCall::getMetadata()
 
  • return mixed The metadata sent by the server
public Grpc\AbstractCall::getPeer()
 
  • return string The URI of the endpoint
public Grpc\AbstractCall::getTrailingMetadata()
 
  • return mixed The trailing metadata sent by the server
public popReceivedCalls()
 

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

  • return array An array of received requests
public Grpc\AbstractCall::setCallCredentials( $call_credentials)
 

Set the CallCredentials for the underlying Call.

  • param \CallCredentials $call_credentials The CallCredentials object
public Grpc\ClientStreamingCall::start(array $metadata = [])
 

Start the call.

  • param array $metadata Metadata to send with the call, if applicable (optional)
public wait()
 

Immediately return the preset response object and status.

  • return array The response object and status.
public write( $request, array $options = [])
 

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

  • param \Message|mixed $request The request object
  • param array $options An array of options
  • throws \ApiException
Properties
protected Grpc\AbstractCall::$call = NULL
 
  • var \Call
protected Grpc\AbstractCall::$deserialize = NULL
protected Grpc\AbstractCall::$metadata = NULL
protected Grpc\AbstractCall::$trailing_metadata = NULL
Methods
protected Grpc\AbstractCall::_deserializeResponse( $value)
 

Deserialize a response value to an object.

  • param string $value The binary value to deserialize
  • return mixed The deserialized value
protected Grpc\AbstractCall::_serializeMessage( $data)
 

Serialize a message to the protobuf binary format.

  • param mixed $data The Protobuf message
  • return string The protobuf binary format
Properties
private $mockUnaryCall = NULL
private $receivedWrites = []
private $waitCalled = false
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration