public function testSendMessage() { $message = new RpbPutReq(); $reqCode = RiakMessageCodes::PUT_REQ; $respCode = RiakMessageCodes::PUT_RESP; $respBody = Protobuf::encode(new RpbPutResp()); $stream = $this->getMock('Riak\\Client\\Core\\Transport\\Proto\\ProtoStream', [], [], '', false); $this->connection->expects($this->once())->method('send')->willReturn($stream); $this->connection->expects($this->once())->method('receive')->willReturn([$respCode, $respBody])->with($this->equalTo($stream)); $this->assertInstanceOf('Riak\\Client\\ProtoBuf\\RpbPutResp', $this->instance->send($message, $reqCode, $respCode)); }