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;