aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php
diff options
context:
space:
mode:
authorGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-02-04 10:05:15 -0800
committerGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-02-04 10:05:15 -0800
commit90277ee1382ef468342c717d7ac78c50e9a170b2 (patch)
tree7e922f4ad6a1a105a4bf61f5967422ebc332b0c3 /src/php
parent8886a55b6e86677c30c73e686ad16eb28069c55b (diff)
parent554fe351d30f59aee8c9c15338a5545f15375dd2 (diff)
Merge pull request #379 from murgatroid99/php_cancellation_interop_tests
Added cancel_after_first_response interop test
Diffstat (limited to 'src/php')
-rwxr-xr-xsrc/php/tests/interop/interop_client.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index d1f994a84b..5266e9a9fa 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -149,6 +149,25 @@ function pingPong($stub) {
'Call did not complete successfully');
}
+function cancelAfterFirstResponse($stub) {
+ $call = $stub->FullDuplexCall();
+ $request = new grpc\testing\StreamingOutputCallRequest();
+ $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
+ $response_parameters = new grpc\testing\ResponseParameters();
+ $response_parameters->setSize(31415);
+ $request->addResponseParameters($response_parameters);
+ $payload = new grpc\testing\Payload();
+ $payload->setBody(str_repeat("\0", 27182));
+ $request->setPayload($payload);
+
+ $call->write($request);
+ $response = $call->read();
+
+ $call->cancel();
+ hardAssert($call->getStatus()->code === Grpc\STATUS_CANCELLED,
+ 'Call status was not CANCELLED');
+}
+
$args = getopt('', array('server_host:', 'server_port:', 'test_case:'));
if (!array_key_exists('server_host', $args) ||
!array_key_exists('server_port', $args) ||
@@ -187,4 +206,6 @@ switch($args['test_case']) {
case 'ping_pong':
pingPong($stub);
break;
+ case 'cancel_after_first_response':
+ cancelAfterFirstResponse($stub);
} \ No newline at end of file