From 03e170eaf01b0790feffc582dd1e3d1c451715e4 Mon Sep 17 00:00:00 2001 From: Stanley Cheung <stanleycheung@google.com> Date: Fri, 28 Aug 2015 16:11:00 -0700 Subject: [PATCH] php: add cancel_after_begin interop test --- src/php/tests/interop/interop_client.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 28782735c0..d55d5629b7 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -250,6 +250,19 @@ function pingPong($stub) { 'Call did not complete successfully'); } +/** + * Run the cancel_after_begin test. + * Passes when run against the Node server as of 2015-08-28 + * @param $stub Stub object that has service methods. + */ +function cancelAfterBegin($stub) { + $call = $stub->StreamingInputCall(); + $call->cancel(); + list($result, $status) = $call->wait(); + hardAssert($status->code === Grpc\STATUS_CANCELLED, + 'Call status was not CANCELLED'); +} + /** * Run the cancel_after_first_response test. * Passes when run against the Node server as of 2015-04-30 @@ -357,6 +370,9 @@ switch ($args['test_case']) { case 'ping_pong': pingPong($stub); break; + case 'cancel_after_begin': + cancelAfterBegin($stub); + break; case 'cancel_after_first_response': cancelAfterFirstResponse($stub); break; @@ -372,11 +388,6 @@ switch ($args['test_case']) { case 'jwt_token_creds': jwtTokenCreds($stub, $args); break; - case 'cancel_after_begin': - // Currently unimplementable with the current API design - // Specifically, in the ClientStreamingCall->start() method, the - // messages are sent immediately after metadata is sent. There is - // currently no way to cancel before messages are sent. default: echo "Unsupported test case $args[test_case]\n"; exit(1); -- GitLab