From e5ba29f337121befd876b2a9649fdb2cf7c7797c Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 9 Oct 2015 11:18:45 -0700 Subject: [PATCH] php: implement empty_stream interop test --- src/php/tests/interop/interop_client.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index d55d5629b74..d782c101c23 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -250,6 +250,22 @@ function pingPong($stub) { 'Call did not complete successfully'); } +/** + * Run the empty_stream test. + * Passes when run against the Node server as of 2015-10-09 + * @param $stub Stub object that has service methods. + */ +function emptyStream($stub) { + // for the current PHP implementation, $call->read() will wait + // forever for a server response if the server is not sending any. + // so this test is imeplemented as a timeout to indicate the absence + // of receiving any response from the server + $call = $stub->FullDuplexCall(array('timeout' => 100000)); + hardAssert($call->read() === null, 'Server returned too many responses'); + hardAssert($call->getStatus()->code === Grpc\STATUS_DEADLINE_EXCEEDED, + 'Call did not complete successfully'); +} + /** * Run the cancel_after_begin test. * Passes when run against the Node server as of 2015-08-28 @@ -370,6 +386,9 @@ switch ($args['test_case']) { case 'ping_pong': pingPong($stub); break; + case 'empty_stream': + emptyStream($stub); + break; case 'cancel_after_begin': cancelAfterBegin($stub); break;