aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests/unit_tests/EndToEndTest.php
diff options
context:
space:
mode:
authorGravatar Robbie Shade <rjshade@google.com>2015-09-14 13:18:14 -0400
committerGravatar Robbie Shade <rjshade@google.com>2015-09-14 13:18:14 -0400
commitf798b779fc35e0be603f07589f3f27efa316da7f (patch)
tree7c9e0b908218f6ed6207139c2065c6b78358fa5a /src/php/tests/unit_tests/EndToEndTest.php
parent780b07e6442b06039a936382ce10fe0c4a30f4af (diff)
parent261666696496174f824d9e43a60559040eda3055 (diff)
Merge remote-tracking branch 'upstream/master' into rename_callback
Diffstat (limited to 'src/php/tests/unit_tests/EndToEndTest.php')
-rwxr-xr-xsrc/php/tests/unit_tests/EndToEndTest.php49
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,