Fixed PHP interop tests

pull/309/head
murgatroid99 10 years ago
parent b24b50094c
commit f21eb2573b
  1. 6
      src/php/lib/Grpc/ActiveCall.php
  2. 4
      src/php/lib/Grpc/BaseStub.php
  3. 9
      src/php/tests/interop/empty.php
  4. 2
      src/php/tests/interop/interop_client.php
  5. 213
      src/php/tests/interop/messages.php
  6. 22
      src/php/tests/interop/test.php

@ -28,9 +28,9 @@ class ActiveCall {
$this->flags = $flags;
// Invoke the call.
$this->call->start_invoke($this->completion_queue,
CLIENT_METADATA_READ,
FINISHED, 0);
$this->call->invoke($this->completion_queue,
CLIENT_METADATA_READ,
FINISHED, 0);
$metadata_event = $this->completion_queue->pluck(CLIENT_METADATA_READ,
Timeval::inf_future());
$this->metadata = $metadata_event->data;

@ -10,8 +10,8 @@ class BaseStub {
private $channel;
public function __construct($hostname) {
$this->channel = new Channel($hostname, []);
public function __construct($hostname, $opts) {
$this->channel = new Channel($hostname, $opts);
}
/**

@ -1,9 +1,9 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: net/proto2/proto/empty.proto
// Date: 2014-12-03 22:02:20
// Source: test/cpp/interop/empty.proto
// Date: 2015-01-30 21:44:54
namespace proto2 {
namespace grpc\testing {
class EmptyMessage extends \DrSlump\Protobuf\Message {
@ -13,7 +13,7 @@ namespace proto2 {
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'proto2.EmptyMessage');
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.EmptyMessage');
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
@ -23,4 +23,3 @@ namespace proto2 {
}
}
}

@ -25,7 +25,7 @@ function hardAssert($value, $error_message) {
* @param $stub Stub object that has service methods
*/
function emptyUnary($stub) {
list($result, $status) = $stub->EmptyCall(new proto2\EmptyMessage())->wait();
list($result, $status) = $stub->EmptyCall(new grpc\testing\EmptyMessage())->wait();
hardAssert($status->code == Grpc\STATUS_OK, 'Call did not complete successfully');
hardAssert($result != null, 'Call completed with a null response');
}

@ -1,7 +1,7 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: third_party/stubby/testing/proto/messages.proto
// Date: 2014-12-03 22:02:20
// Source: test/cpp/interop/messages.proto
// Date: 2015-01-30 21:44:54
namespace grpc\testing {
@ -142,6 +142,12 @@ namespace grpc\testing {
/** @var \grpc\testing\Payload */
public $payload = null;
/** @var boolean */
public $fill_username = null;
/** @var boolean */
public $fill_oauth_scope = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -176,6 +182,22 @@ namespace grpc\testing {
$f->reference = '\grpc\testing\Payload';
$descriptor->addField($f);
// OPTIONAL BOOL fill_username = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "fill_username";
$f->type = \DrSlump\Protobuf::TYPE_BOOL;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL BOOL fill_oauth_scope = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "fill_oauth_scope";
$f->type = \DrSlump\Protobuf::TYPE_BOOL;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -293,6 +315,80 @@ namespace grpc\testing {
public function setPayload(\grpc\testing\Payload $value){
return $this->_set(3, $value);
}
/**
* Check if <fill_username> has a value
*
* @return boolean
*/
public function hasFillUsername(){
return $this->_has(4);
}
/**
* Clear <fill_username> value
*
* @return \grpc\testing\SimpleRequest
*/
public function clearFillUsername(){
return $this->_clear(4);
}
/**
* Get <fill_username> value
*
* @return boolean
*/
public function getFillUsername(){
return $this->_get(4);
}
/**
* Set <fill_username> value
*
* @param boolean $value
* @return \grpc\testing\SimpleRequest
*/
public function setFillUsername( $value){
return $this->_set(4, $value);
}
/**
* Check if <fill_oauth_scope> has a value
*
* @return boolean
*/
public function hasFillOauthScope(){
return $this->_has(5);
}
/**
* Clear <fill_oauth_scope> value
*
* @return \grpc\testing\SimpleRequest
*/
public function clearFillOauthScope(){
return $this->_clear(5);
}
/**
* Get <fill_oauth_scope> value
*
* @return boolean
*/
public function getFillOauthScope(){
return $this->_get(5);
}
/**
* Set <fill_oauth_scope> value
*
* @param boolean $value
* @return \grpc\testing\SimpleRequest
*/
public function setFillOauthScope( $value){
return $this->_set(5, $value);
}
}
}
@ -303,8 +399,11 @@ namespace grpc\testing {
/** @var \grpc\testing\Payload */
public $payload = null;
/** @var int */
public $effective_gaia_user_id = null;
/** @var string */
public $username = null;
/** @var string */
public $oauth_scope = null;
/** @var \Closure[] */
@ -323,11 +422,19 @@ namespace grpc\testing {
$f->reference = '\grpc\testing\Payload';
$descriptor->addField($f);
// OPTIONAL INT64 effective_gaia_user_id = 2
// OPTIONAL STRING username = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "effective_gaia_user_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->name = "username";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING oauth_scope = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "oauth_scope";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
@ -376,109 +483,77 @@ namespace grpc\testing {
}
/**
* Check if <effective_gaia_user_id> has a value
* Check if <username> has a value
*
* @return boolean
*/
public function hasEffectiveGaiaUserId(){
public function hasUsername(){
return $this->_has(2);
}
/**
* Clear <effective_gaia_user_id> value
* Clear <username> value
*
* @return \grpc\testing\SimpleResponse
*/
public function clearEffectiveGaiaUserId(){
public function clearUsername(){
return $this->_clear(2);
}
/**
* Get <effective_gaia_user_id> value
* Get <username> value
*
* @return int
* @return string
*/
public function getEffectiveGaiaUserId(){
public function getUsername(){
return $this->_get(2);
}
/**
* Set <effective_gaia_user_id> value
* Set <username> value
*
* @param int $value
* @param string $value
* @return \grpc\testing\SimpleResponse
*/
public function setEffectiveGaiaUserId( $value){
public function setUsername( $value){
return $this->_set(2, $value);
}
}
}
namespace grpc\testing {
class SimpleContext extends \DrSlump\Protobuf\Message {
/** @var string */
public $value = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'grpc.testing.SimpleContext');
// OPTIONAL STRING value = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "value";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <value> has a value
* Check if <oauth_scope> has a value
*
* @return boolean
*/
public function hasValue(){
return $this->_has(1);
public function hasOauthScope(){
return $this->_has(3);
}
/**
* Clear <value> value
* Clear <oauth_scope> value
*
* @return \grpc\testing\SimpleContext
* @return \grpc\testing\SimpleResponse
*/
public function clearValue(){
return $this->_clear(1);
public function clearOauthScope(){
return $this->_clear(3);
}
/**
* Get <value> value
* Get <oauth_scope> value
*
* @return string
*/
public function getValue(){
return $this->_get(1);
public function getOauthScope(){
return $this->_get(3);
}
/**
* Set <value> value
* Set <oauth_scope> value
*
* @param string $value
* @return \grpc\testing\SimpleContext
* @return \grpc\testing\SimpleResponse
*/
public function setValue( $value){
return $this->_set(1, $value);
public function setOauthScope( $value){
return $this->_set(3, $value);
}
}
}
@ -997,15 +1072,3 @@ namespace grpc\testing {
}
}
namespace {
\proto2\bridge\MessageSet::extension(function(){
// OPTIONAL MESSAGE grpc\testing\SimpleContext\message_set_extension = 71139615
$f = new \DrSlump\Protobuf\Field();
$f->number = 71139615;
$f->name = "grpc\testing\SimpleContext\message_set_extension";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\grpc\testing\SimpleContext';
return $f;
});
}

@ -1,52 +1,52 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: third_party/stubby/testing/proto/test.proto
// Date: 2014-12-03 22:02:20
// Source: test/cpp/interop/test.proto
// Date: 2015-01-30 21:44:54
namespace grpc\testing {
class TestServiceClient extends \Grpc\BaseStub {
/**
* @param proto2\EmptyMessage $input
* @return proto2\EmptyMessage
* @param grpc\testing\EmptyMessage $input
* @return grpc\testing\EmptyMessage
*/
public function EmptyCall(\proto2\EmptyMessage $argument, $metadata = array()) {
return $this->_simpleRequest('/TestService/EmptyCall', $argument, '\proto2\EmptyMessage::deserialize', $metadata);
public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) {
return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata);
}
/**
* @param grpc\testing\SimpleRequest $input
* @return grpc\testing\SimpleResponse
*/
public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) {
return $this->_simpleRequest('/TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata);
return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function StreamingOutputCall($argument, $metadata = array()) {
return $this->_serverStreamRequest('/TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingInputCallRequest $input
* @return grpc\testing\StreamingInputCallResponse
*/
public function StreamingInputCall($arguments, $metadata = array()) {
return $this->_clientStreamRequest('/TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata);
return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function FullDuplexCall($metadata = array()) {
return $this->_bidiRequest('/TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
/**
* @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/
public function HalfDuplexCall($metadata = array()) {
return $this->_bidiRequest('/TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
}
}
}

Loading…
Cancel
Save