diff options
author | Stanley Cheung <stanleycheung@google.com> | 2015-08-24 16:58:42 -0700 |
---|---|---|
committer | Stanley Cheung <stanleycheung@google.com> | 2015-09-02 13:34:40 -0700 |
commit | 3ab8e79b0111dc93696d72e815531b5ee3124230 (patch) | |
tree | badc54d70b58bb289fda46dba0d0314d1d08a492 /src/php/tests/unit_tests/EndToEndTest.php | |
parent | dea2648a6acb5c16b158335b4deb02caf4f02487 (diff) |
php: support per message compression disable
Diffstat (limited to 'src/php/tests/unit_tests/EndToEndTest.php')
-rwxr-xr-x | src/php/tests/unit_tests/EndToEndTest.php | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 4c0cf91d51..bd464f939f 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -91,6 +91,51 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ 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); + + $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 + ]); + + $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() { $deadline = Grpc\Timeval::infFuture(); $req_text = 'client_server_full_request_response'; @@ -104,7 +149,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], 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); @@ -117,7 +162,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], - Grpc\OP_SEND_MESSAGE => $reply_text, + Grpc\OP_SEND_MESSAGE => ['message' => $reply_text], Grpc\OP_SEND_STATUS_FROM_SERVER => [ 'metadata' => [], 'code' => Grpc\STATUS_OK, |