|
|
@ -107,6 +107,53 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ |
|
|
|
unset($server_call); |
|
|
|
unset($server_call); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testMessageWriteFlags() { |
|
|
|
|
|
|
|
$deadline = Grpc\Timeval::infFuture(); |
|
|
|
|
|
|
|
$req_text = 'message_write_flags_test'; |
|
|
|
|
|
|
|
$status_text = 'xyz'; |
|
|
|
|
|
|
|
$call = new Grpc\Call($this->channel, |
|
|
|
|
|
|
|
'dummy_method', |
|
|
|
|
|
|
|
$deadline, |
|
|
|
|
|
|
|
$this->host_override); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$event = $call->startBatch([ |
|
|
|
|
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
|
|
|
|
Grpc\OP_SEND_MESSAGE => ['message' => $req_text, |
|
|
|
|
|
|
|
'flags' => Grpc\WRITE_NO_COMPRESS], |
|
|
|
|
|
|
|
Grpc\OP_SEND_CLOSE_FROM_CLIENT => true |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($event->send_metadata); |
|
|
|
|
|
|
|
$this->assertTrue($event->send_close); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$event = $this->server->requestCall(); |
|
|
|
|
|
|
|
$this->assertSame('dummy_method', $event->method); |
|
|
|
|
|
|
|
$server_call = $event->call; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$event = $server_call->startBatch([ |
|
|
|
|
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
|
|
|
|
Grpc\OP_SEND_STATUS_FROM_SERVER => [ |
|
|
|
|
|
|
|
'metadata' => [], |
|
|
|
|
|
|
|
'code' => Grpc\STATUS_OK, |
|
|
|
|
|
|
|
'details' => $status_text |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$event = $call->startBatch([ |
|
|
|
|
|
|
|
Grpc\OP_RECV_INITIAL_METADATA => true, |
|
|
|
|
|
|
|
Grpc\OP_RECV_STATUS_ON_CLIENT => true |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertSame([], $event->metadata); |
|
|
|
|
|
|
|
$status = $event->status; |
|
|
|
|
|
|
|
$this->assertSame([], $status->metadata); |
|
|
|
|
|
|
|
$this->assertSame(Grpc\STATUS_OK, $status->code); |
|
|
|
|
|
|
|
$this->assertSame($status_text, $status->details); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unset($call); |
|
|
|
|
|
|
|
unset($server_call); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testClientServerFullRequestResponse() { |
|
|
|
public function testClientServerFullRequestResponse() { |
|
|
|
$deadline = Grpc\Timeval::infFuture(); |
|
|
|
$deadline = Grpc\Timeval::infFuture(); |
|
|
|
$req_text = 'client_server_full_request_response'; |
|
|
|
$req_text = 'client_server_full_request_response'; |
|
|
@ -121,7 +168,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ |
|
|
|
$event = $call->startBatch([ |
|
|
|
$event = $call->startBatch([ |
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, |
|
|
|
Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, |
|
|
|
Grpc\OP_SEND_MESSAGE => $req_text |
|
|
|
Grpc\OP_SEND_MESSAGE => ['message' => $req_text] |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($event->send_metadata); |
|
|
|
$this->assertTrue($event->send_metadata); |
|
|
@ -134,7 +181,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ |
|
|
|
|
|
|
|
|
|
|
|
$event = $server_call->startBatch([ |
|
|
|
$event = $server_call->startBatch([ |
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
Grpc\OP_SEND_INITIAL_METADATA => [], |
|
|
|
Grpc\OP_SEND_MESSAGE => $reply_text, |
|
|
|
Grpc\OP_SEND_MESSAGE => ['message' => $reply_text], |
|
|
|
Grpc\OP_SEND_STATUS_FROM_SERVER => [ |
|
|
|
Grpc\OP_SEND_STATUS_FROM_SERVER => [ |
|
|
|
'metadata' => [], |
|
|
|
'metadata' => [], |
|
|
|
'code' => Grpc\STATUS_OK, |
|
|
|
'code' => Grpc\STATUS_OK, |
|
|
|