aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/php/tests')
-rw-r--r--src/php/tests/generated_code/AbstractGeneratedCodeTest.php5
-rw-r--r--src/php/tests/generated_code/math.proto83
-rw-r--r--src/php/tests/interop/empty.proto43
-rwxr-xr-xsrc/php/tests/interop/interop_client.php115
-rw-r--r--src/php/tests/interop/messages.proto162
-rw-r--r--src/php/tests/interop/test.proto78
-rw-r--r--src/php/tests/unit_tests/CallCredentials2Test.php3
7 files changed, 67 insertions, 422 deletions
diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
index 75922d4cf7..8fe9bc26d8 100644
--- a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
+++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php
@@ -32,7 +32,8 @@
*
*/
require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php');
-require_once dirname(__FILE__).'/math.php';
+require_once dirname(__FILE__).'/math.pb.php';
+require_once dirname(__FILE__).'/math_grpc_pb.php';
abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
{
@@ -92,7 +93,7 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
public function testTimeout()
{
$div_arg = new math\DivArgs();
- $call = self::$client->Div($div_arg, [], ['timeout' => 100]);
+ $call = self::$client->Div($div_arg, [], ['timeout' => 1]);
list($response, $status) = $call->wait();
$this->assertSame(\Grpc\STATUS_DEADLINE_EXCEEDED, $status->code);
}
diff --git a/src/php/tests/generated_code/math.proto b/src/php/tests/generated_code/math.proto
deleted file mode 100644
index c872ee6e0b..0000000000
--- a/src/php/tests/generated_code/math.proto
+++ /dev/null
@@ -1,83 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// TODO: start using src/proto/math/math.proto and remove this file once
-// PHP supports proto3.
-
-syntax = "proto2";
-
-package math;
-
-message DivArgs {
- optional int64 dividend = 1 [default = 0];
- optional int64 divisor = 2 [default = 0];
-}
-
-message DivReply {
- optional int64 quotient = 1 [default = 0];
- optional int64 remainder = 2 [default = 0];
-}
-
-message FibArgs {
- optional int64 limit = 1 [default = 0];
-}
-
-message Num {
- optional int64 num = 1 [default = 0];
-}
-
-message FibReply {
- optional int64 count = 1 [default = 0];
-}
-
-service Math {
- // Div divides args.dividend by args.divisor and returns the quotient and
- // remainder.
- rpc Div (DivArgs) returns (DivReply) {
- }
-
- // DivMany accepts an arbitrary number of division args from the client stream
- // and sends back the results in the reply stream. The stream continues until
- // the client closes its end; the server does the same after sending all the
- // replies. The stream ends immediately if either end aborts.
- rpc DivMany (stream DivArgs) returns (stream DivReply) {
- }
-
- // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
- // generates up to limit numbers; otherwise it continues until the call is
- // canceled. Unlike Fib above, Fib has no final FibReply.
- rpc Fib (FibArgs) returns (stream Num) {
- }
-
- // Sum sums a stream of numbers, returning the final result once the stream
- // is closed.
- rpc Sum (stream Num) returns (Num) {
- }
-}
diff --git a/src/php/tests/interop/empty.proto b/src/php/tests/interop/empty.proto
deleted file mode 100644
index 4200d7b519..0000000000
--- a/src/php/tests/interop/empty.proto
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto2";
-
-package grpc.testing;
-
-// An empty message that you can re-use to avoid defining duplicated empty
-// messages in your project. A typical example is to use it as argument or the
-// return value of a service API. For instance:
-//
-// service Foo {
-// rpc Bar (grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage) { };
-// };
-//
-message EmptyMessage {}
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index 94ceeda02c..124d324913 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -32,9 +32,8 @@
*
*/
require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php');
-require 'empty.php';
-require 'messages.php';
-require 'test.php';
+require 'src/proto/grpc/testing/test.pb.php';
+require 'src/proto/grpc/testing/test_grpc_pb.php';
use Google\Auth\CredentialsLoader;
use Google\Auth\ApplicationDefaultCredentials;
use GuzzleHttp\ClientInterface;
@@ -70,7 +69,8 @@ function hardAssertIfStatusOk($status)
*/
function emptyUnary($stub)
{
- list($result, $status) = $stub->EmptyCall(new grpc\testing\EmptyMessage())->wait();
+ list($result, $status) =
+ $stub->EmptyCall(new grpc\testing\EmptyMessage())->wait();
hardAssertIfStatusOk($status);
hardAssert($result !== null, 'Call completed with a null response');
}
@@ -92,8 +92,8 @@ function largeUnary($stub)
* @param $fillUsername boolean whether to fill result with username
* @param $fillOauthScope boolean whether to fill result with oauth scope
*/
-function performLargeUnary($stub, $fillUsername = false, $fillOauthScope = false,
- $callback = false)
+function performLargeUnary($stub, $fillUsername = false,
+ $fillOauthScope = false, $callback = false)
{
$request_len = 271828;
$response_len = 314159;
@@ -118,11 +118,11 @@ function performLargeUnary($stub, $fillUsername = false, $fillOauthScope = false
hardAssert($result !== null, 'Call returned a null response');
$payload = $result->getPayload();
hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
- 'Payload had the wrong type');
+ 'Payload had the wrong type');
hardAssert(strlen($payload->getBody()) === $response_len,
- 'Payload had the wrong length');
+ 'Payload had the wrong length');
hardAssert($payload->getBody() === str_repeat("\0", $response_len),
- 'Payload had the wrong content');
+ 'Payload had the wrong content');
return $result;
}
@@ -141,11 +141,12 @@ function serviceAccountCreds($stub, $args)
$jsonKey = json_decode(
file_get_contents(getenv(CredentialsLoader::ENV_VAR)),
true);
- $result = performLargeUnary($stub, $fillUsername = true, $fillOauthScope = true);
- hardAssert($result->getUsername() == $jsonKey['client_email'],
- 'invalid email returned');
+ $result = performLargeUnary($stub, $fillUsername = true,
+ $fillOauthScope = true);
+ hardAssert($result->getUsername() === $jsonKey['client_email'],
+ 'invalid email returned');
hardAssert(strpos($args['oauth_scope'], $result->getOauthScope()) !== false,
- 'invalid oauth scope returned');
+ 'invalid oauth scope returned');
}
/**
@@ -163,9 +164,10 @@ function computeEngineCreds($stub, $args)
if (!array_key_exists('default_service_account', $args)) {
throw new Exception('Missing default_service_account');
}
- $result = performLargeUnary($stub, $fillUsername = true, $fillOauthScope = true);
- hardAssert($args['default_service_account'] == $result->getUsername(),
- 'invalid email returned');
+ $result = performLargeUnary($stub, $fillUsername = true,
+ $fillOauthScope = true);
+ hardAssert($args['default_service_account'] === $result->getUsername(),
+ 'invalid email returned');
}
/**
@@ -179,9 +181,10 @@ function jwtTokenCreds($stub, $args)
$jsonKey = json_decode(
file_get_contents(getenv(CredentialsLoader::ENV_VAR)),
true);
- $result = performLargeUnary($stub, $fillUsername = true, $fillOauthScope = true);
- hardAssert($result->getUsername() == $jsonKey['client_email'],
- 'invalid email returned');
+ $result = performLargeUnary($stub, $fillUsername = true,
+ $fillOauthScope = true);
+ hardAssert($result->getUsername() === $jsonKey['client_email'],
+ 'invalid email returned');
}
/**
@@ -195,9 +198,10 @@ function oauth2AuthToken($stub, $args)
$jsonKey = json_decode(
file_get_contents(getenv(CredentialsLoader::ENV_VAR)),
true);
- $result = performLargeUnary($stub, $fillUsername = true, $fillOauthScope = true);
- hardAssert($result->getUsername() == $jsonKey['client_email'],
- 'invalid email returned');
+ $result = performLargeUnary($stub, $fillUsername = true,
+ $fillOauthScope = true);
+ hardAssert($result->getUsername() === $jsonKey['client_email'],
+ 'invalid email returned');
}
function updateAuthMetadataCallback($context)
@@ -209,8 +213,9 @@ function updateAuthMetadataCallback($context)
$metadata = [];
$result = $auth_credentials->updateMetadata([], $authUri);
foreach ($result as $key => $value) {
- $metadata[strtolower($key)] = $value;
+ $metadata[strtolower($key)] = $value;
}
+
return $metadata;
}
@@ -226,10 +231,11 @@ function perRpcCreds($stub, $args)
file_get_contents(getenv(CredentialsLoader::ENV_VAR)),
true);
- $result = performLargeUnary($stub, $fillUsername = true, $fillOauthScope = true,
+ $result = performLargeUnary($stub, $fillUsername = true,
+ $fillOauthScope = true,
'updateAuthMetadataCallback');
- hardAssert($result->getUsername() == $jsonKey['client_email'],
- 'invalid email returned');
+ hardAssert($result->getUsername() === $jsonKey['client_email'],
+ 'invalid email returned');
}
/**
@@ -258,7 +264,7 @@ function clientStreaming($stub)
list($result, $status) = $call->wait();
hardAssertIfStatusOk($status);
hardAssert($result->getAggregatedPayloadSize() === 74922,
- 'aggregated_payload_size was incorrect');
+ 'aggregated_payload_size was incorrect');
}
/**
@@ -275,7 +281,7 @@ function serverStreaming($stub)
foreach ($sizes as $size) {
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize($size);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
}
$call = $stub->StreamingOutputCall($request);
@@ -283,10 +289,11 @@ function serverStreaming($stub)
foreach ($call->responses() as $value) {
hardAssert($i < 4, 'Too many responses');
$payload = $value->getPayload();
- hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
- 'Payload '.$i.' had the wrong type');
+ hardAssert(
+ $payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
+ 'Payload '.$i.' had the wrong type');
hardAssert(strlen($payload->getBody()) === $sizes[$i],
- 'Response '.$i.' had the wrong length');
+ 'Response '.$i.' had the wrong length');
$i += 1;
}
hardAssertIfStatusOk($call->getStatus());
@@ -308,7 +315,7 @@ function pingPong($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize($response_lengths[$i]);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", $request_lengths[$i]));
$request->setPayload($payload);
@@ -318,10 +325,11 @@ function pingPong($stub)
hardAssert($response !== null, 'Server returned too few responses');
$payload = $response->getPayload();
- hardAssert($payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
- 'Payload '.$i.' had the wrong type');
+ hardAssert(
+ $payload->getType() === grpc\testing\PayloadType::COMPRESSABLE,
+ 'Payload '.$i.' had the wrong type');
hardAssert(strlen($payload->getBody()) === $response_lengths[$i],
- 'Payload '.$i.' had the wrong length');
+ 'Payload '.$i.' had the wrong length');
}
$call->writesDone();
hardAssert($call->read() === null, 'Server returned too many responses');
@@ -352,7 +360,7 @@ function cancelAfterBegin($stub)
$call->cancel();
list($result, $status) = $call->wait();
hardAssert($status->code === Grpc\STATUS_CANCELLED,
- 'Call status was not CANCELLED');
+ 'Call status was not CANCELLED');
}
/**
@@ -367,7 +375,7 @@ function cancelAfterFirstResponse($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize(31415);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", 27182));
$request->setPayload($payload);
@@ -377,7 +385,7 @@ function cancelAfterFirstResponse($stub)
$call->cancel();
hardAssert($call->getStatus()->code === Grpc\STATUS_CANCELLED,
- 'Call status was not CANCELLED');
+ 'Call status was not CANCELLED');
}
function timeoutOnSleepingServer($stub)
@@ -387,7 +395,7 @@ function timeoutOnSleepingServer($stub)
$request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE);
$response_parameters = new grpc\testing\ResponseParameters();
$response_parameters->setSize(8);
- $request->addResponseParameters($response_parameters);
+ $request->getResponseParameters()[] = $response_parameters;
$payload = new grpc\testing\Payload();
$payload->setBody(str_repeat("\0", 9));
$request->setPayload($payload);
@@ -396,7 +404,7 @@ function timeoutOnSleepingServer($stub)
$response = $call->read();
hardAssert($call->getStatus()->code === Grpc\STATUS_DEADLINE_EXCEEDED,
- 'Call status was not DEADLINE_EXCEEDED');
+ 'Call status was not DEADLINE_EXCEEDED');
}
function customMetadata($stub)
@@ -425,9 +433,9 @@ function customMetadata($stub)
$initial_metadata = $call->getMetadata();
hardAssert(array_key_exists($ECHO_INITIAL_KEY, $initial_metadata),
'Initial metadata does not contain expected key');
- hardAssert($initial_metadata[$ECHO_INITIAL_KEY][0] ==
- $ECHO_INITIAL_VALUE,
- 'Incorrect initial metadata value');
+ hardAssert(
+ $initial_metadata[$ECHO_INITIAL_KEY][0] === $ECHO_INITIAL_VALUE,
+ 'Incorrect initial metadata value');
list($result, $status) = $call->wait();
hardAssertIfStatusOk($status);
@@ -435,8 +443,9 @@ function customMetadata($stub)
$trailing_metadata = $call->getTrailingMetadata();
hardAssert(array_key_exists($ECHO_TRAILING_KEY, $trailing_metadata),
'Trailing metadata does not contain expected key');
- hardAssert($trailing_metadata[$ECHO_TRAILING_KEY][0] ==
- $ECHO_TRAILING_VALUE, 'Incorrect trailing metadata value');
+ hardAssert(
+ $trailing_metadata[$ECHO_TRAILING_KEY][0] === $ECHO_TRAILING_VALUE,
+ 'Incorrect trailing metadata value');
$streaming_call = $stub->FullDuplexCall($metadata);
@@ -451,7 +460,7 @@ function customMetadata($stub)
hardAssert(array_key_exists($ECHO_TRAILING_KEY,
$streaming_trailing_metadata),
'Trailing metadata does not contain expected key');
- hardAssert($streaming_trailing_metadata[$ECHO_TRAILING_KEY][0] ==
+ hardAssert($streaming_trailing_metadata[$ECHO_TRAILING_KEY][0] ===
$ECHO_TRAILING_VALUE, 'Incorrect trailing metadata value');
}
@@ -506,7 +515,7 @@ function _makeStub($args)
throw new Exception('Missing argument: --test_case is required');
}
- if ($args['server_port'] == 443) {
+ if ($args['server_port'] === 443) {
$server_address = $args['server_host'];
} else {
$server_address = $args['server_host'].':'.$args['server_port'];
@@ -548,7 +557,7 @@ function _makeStub($args)
if (in_array($test_case, ['service_account_creds',
'compute_engine_creds', 'jwt_token_creds', ])) {
- if ($test_case == 'jwt_token_creds') {
+ if ($test_case === 'jwt_token_creds') {
$auth_credentials = ApplicationDefaultCredentials::getCredentials();
} else {
$auth_credentials = ApplicationDefaultCredentials::getCredentials(
@@ -558,7 +567,7 @@ function _makeStub($args)
$opts['update_metadata'] = $auth_credentials->getUpdateMetadataFunc();
}
- if ($test_case == 'oauth2_auth_token') {
+ if ($test_case === 'oauth2_auth_token') {
$auth_credentials = ApplicationDefaultCredentials::getCredentials(
$args['oauth_scope']
);
@@ -578,8 +587,9 @@ function _makeStub($args)
$opts['update_metadata'] = $update_metadata;
}
- if ($test_case == 'unimplemented_method') {
- $stub = new grpc\testing\UnimplementedServiceClient($server_address, $opts);
+ if ($test_case === 'unimplemented_method') {
+ $stub = new grpc\testing\UnimplementedServiceClient($server_address,
+ $opts);
} else {
$stub = new grpc\testing\TestServiceClient($server_address, $opts);
}
@@ -656,7 +666,8 @@ function interop_main($args, $stub = false)
return $stub;
}
-if (isset($_SERVER['PHP_SELF']) && preg_match('/interop_client/', $_SERVER['PHP_SELF'])) {
+if (isset($_SERVER['PHP_SELF']) &&
+ preg_match('/interop_client/', $_SERVER['PHP_SELF'])) {
$args = getopt('', ['server_host:', 'server_port:', 'test_case:',
'use_tls::', 'use_test_ca::',
'server_host_override:', 'oauth_scope:',
diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto
deleted file mode 100644
index 44e3c3b8f9..0000000000
--- a/src/php/tests/interop/messages.proto
+++ /dev/null
@@ -1,162 +0,0 @@
-
-// Copyright 2015-2016, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Message definitions to be used by integration test service definitions.
-
-syntax = "proto2";
-
-package grpc.testing;
-
-// The type of payload that should be returned.
-enum PayloadType {
- // Compressable text format.
- COMPRESSABLE = 0;
-
- // Uncompressable binary format.
- UNCOMPRESSABLE = 1;
-}
-
-// A block of data, to simply increase gRPC message size.
-message Payload {
- // The type of data in body.
- optional PayloadType type = 1 [default = COMPRESSABLE];
- // Primary contents of payload.
- optional bytes body = 2;
-}
-
-// A protobuf representation for grpc status. This is used by test
-// clients to specify a status that the server should attempt to return.
-message EchoStatus {
- optional int32 code = 1;
- optional string message = 2;
-}
-
-// Unary request.
-message SimpleRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, server randomly chooses one from other formats.
- optional PayloadType response_type = 1 [default = COMPRESSABLE];
-
- // Desired payload size in the response from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 response_size = 2;
-
- // Optional input payload sent along with the request.
- optional Payload payload = 3;
-
- // Whether SimpleResponse should include username.
- optional bool fill_username = 4;
-
- // Whether SimpleResponse should include OAuth scope.
- optional bool fill_oauth_scope = 5;
-
- // Whether to request the server to compress the response.
- optional bool request_compressed_response = 6;
-
- // Whether server should return a given status
- optional EchoStatus response_status = 7;
-}
-
-// Unary response, as configured by the request.
-message SimpleResponse {
- // Payload to increase message size.
- optional Payload payload = 1;
- // The user the request came from, for verifying authentication was
- // successful when the client expected it.
- optional string username = 2;
- // OAuth scope.
- optional string oauth_scope = 3;
-}
-
-// Client-streaming request.
-message StreamingInputCallRequest {
- // Optional input payload sent along with the request.
- optional Payload payload = 1;
-
- // Not expecting any payload from the response.
-}
-
-// Client-streaming response.
-message StreamingInputCallResponse {
- // Aggregated size of payloads received from the client.
- optional int32 aggregated_payload_size = 1;
-}
-
-// Configuration for a particular response.
-message ResponseParameters {
- // Desired payload sizes in responses from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- optional int32 size = 1;
-
- // Desired interval between consecutive responses in the response stream in
- // microseconds.
- optional int32 interval_us = 2;
-}
-
-// Server-streaming request.
-message StreamingOutputCallRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, the payload from each response in the stream
- // might be of different types. This is to simulate a mixed type of payload
- // stream.
- optional PayloadType response_type = 1 [default = COMPRESSABLE];
-
- // Configuration for each expected response message.
- repeated ResponseParameters response_parameters = 2;
-
- // Optional input payload sent along with the request.
- optional Payload payload = 3;
-
- // Whether to request the server to compress the response.
- optional bool request_compressed_response = 6;
-
- // Whether server should return a given status
- optional EchoStatus response_status = 7;
-}
-
-// Server-streaming response, as configured by the request and parameters.
-message StreamingOutputCallResponse {
- // Payload to increase response size.
- optional Payload payload = 1;
-}
-
-// For reconnect interop test only.
-// Client tells server what reconnection parameters it used.
-message ReconnectParams {
- optional int32 max_reconnect_backoff_ms = 1;
-}
-
-// For reconnect interop test only.
-// Server tells client whether its reconnects are following the spec and the
-// reconnect backoffs it saw.
-message ReconnectInfo {
- optional bool passed = 1;
- repeated int32 backoff_ms = 2;
-}
diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto
deleted file mode 100644
index 57ef30ee1c..0000000000
--- a/src/php/tests/interop/test.proto
+++ /dev/null
@@ -1,78 +0,0 @@
-
-// Copyright 2015-2016, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
-syntax = "proto2";
-
-import "empty.proto";
-import "messages.proto";
-
-package grpc.testing;
-
-// A simple service to test the various types of RPCs and experiment with
-// performance with various types of payload.
-service TestService {
- // One empty request followed by one empty response.
- rpc EmptyCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage);
-
- // One request followed by one response.
- rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by a sequence of responses (streamed download).
- // The server returns the payload with client desired type and sizes.
- rpc StreamingOutputCall(StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by one response (streamed upload).
- // The server returns the aggregated size of client payload as the result.
- rpc StreamingInputCall(stream StreamingInputCallRequest)
- returns (StreamingInputCallResponse);
-
- // A sequence of requests with each request served by the server immediately.
- // As one request could lead to multiple responses, this interface
- // demonstrates the idea of full duplexing.
- rpc FullDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by a sequence of responses.
- // The server buffers all the client requests and then serves them in order. A
- // stream of responses are returned to the client when the server starts with
- // first request.
- rpc HalfDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-}
-
-// A simple service NOT implemented at servers so clients can test for
-// that case.
-service UnimplementedService {
- // A call that no server should implement
- rpc UnimplementedCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage);
-}
diff --git a/src/php/tests/unit_tests/CallCredentials2Test.php b/src/php/tests/unit_tests/CallCredentials2Test.php
index b3b98a22ca..fa31439c54 100644
--- a/src/php/tests/unit_tests/CallCredentials2Test.php
+++ b/src/php/tests/unit_tests/CallCredentials2Test.php
@@ -170,7 +170,7 @@ class CallCredentials2Test extends PHPUnit_Framework_TestCase
$this->assertTrue(is_string($context->service_url));
$this->assertTrue(is_string($context->method_name));
- return "a string";
+ return 'a string';
}
public function testCallbackWithInvalidReturnValue()
@@ -196,5 +196,4 @@ class CallCredentials2Test extends PHPUnit_Framework_TestCase
$this->assertTrue($event->send_close);
$this->assertTrue($event->status->code == Grpc\STATUS_UNAUTHENTICATED);
}
-
}