aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests/unit_tests/EndToEndTest.php
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-03-11 09:18:06 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-03-11 09:18:06 -0700
commitd8bb9578efa3ff6d287ec7bf735dc97b636b9f04 (patch)
tree93a63d09b01b51c4a9caf2618031e26bda865671 /src/php/tests/unit_tests/EndToEndTest.php
parentafd541cbd35d873a98aee02ed0bd8177f3343410 (diff)
Fixed some tests for new API
Diffstat (limited to 'src/php/tests/unit_tests/EndToEndTest.php')
-rwxr-xr-xsrc/php/tests/unit_tests/EndToEndTest.php31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php
index 0cbc506c8e..076d449362 100755
--- a/src/php/tests/unit_tests/EndToEndTest.php
+++ b/src/php/tests/unit_tests/EndToEndTest.php
@@ -33,11 +33,10 @@
*/
class EndToEndTest extends PHPUnit_Framework_TestCase{
public function setUp() {
- $this->client_queue = new Grpc\CompletionQueue();
- $this->server_queue = new Grpc\CompletionQueue();
$this->server = new Grpc\Server($this->server_queue, []);
$port = $this->server->add_http2_port('0.0.0.0:0');
$this->channel = new Grpc\Channel('localhost:' . $port, []);
+ $this->server->start();
}
public function tearDown() {
@@ -53,6 +52,33 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{
$call = new Grpc\Call($this->channel,
'dummy_method',
$deadline);
+
+ $event = $this->call->start_batch([
+ Grpc\OP_SEND_INITIAL_METADATA => [],
+ Grpc\OP_SEND_CLOSE_FROM_CLIENT => true
+ ]);
+
+ $this->assertTrue($event->send_metadata);
+ $this->assertTrue($event->send_close);
+
+ $event = $this->server->request_call();
+ $this->assertSame('dummy_method', $event->method);
+ $server_call = $event->call;
+
+ $event = $server_call->start_batch([
+ Grpc\OP_SEND_INITIAL_METADATA => [],
+ Grpc\OP_SEND_STATUS_FROM_SERVER => [
+ 'metadata' => [],
+ 'code' => Grpc\STATUS_OK,
+ 'details' => $status_text
+ ],
+ Grpc\OP_RECV_CLOSE_ON_SERVER => true
+ ]);
+
+ $this->assertTrue($event->send_metadata);
+ $this->assertTrue($event->send_status);
+ $this->assertFalse($event->cancelled);
+
$tag = 1;
$call->invoke($this->client_queue, $tag, $tag);
$server_tag = 2;
@@ -64,7 +90,6 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{
$this->assertSame(Grpc\OP_OK, $event->data);
// check that a server rpc new was received
- $this->server->start();
$this->server->request_call($server_tag);
$event = $this->server_queue->next($deadline);
$this->assertNotNull($event);