aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/php/tests')
-rwxr-xr-xsrc/php/tests/interop/interop_client.php11
-rw-r--r--src/php/tests/unit_tests/ChannelTest.php2
-rw-r--r--src/php/tests/unit_tests/ServerTest.php4
3 files changed, 14 insertions, 3 deletions
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index d201915d66..2acf5612c7 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -451,11 +451,22 @@ function customMetadata($stub)
$streaming_request = new grpc\testing\StreamingOutputCallRequest();
$streaming_request->setPayload($payload);
+ $response_parameters = new grpc\testing\ResponseParameters();
+ $response_parameters->setSize($response_len);
+ $streaming_request->getResponseParameters()[] = $response_parameters;
$streaming_call->write($streaming_request);
$streaming_call->writesDone();
+ $result = $streaming_call->read();
hardAssertIfStatusOk($streaming_call->getStatus());
+ $streaming_initial_metadata = $streaming_call->getMetadata();
+ hardAssert(array_key_exists($ECHO_INITIAL_KEY, $streaming_initial_metadata),
+ 'Initial metadata does not contain expected key');
+ hardAssert(
+ $streaming_initial_metadata[$ECHO_INITIAL_KEY][0] === $ECHO_INITIAL_VALUE,
+ 'Incorrect initial metadata value');
+
$streaming_trailing_metadata = $streaming_call->getTrailingMetadata();
hardAssert(array_key_exists($ECHO_TRAILING_KEY,
$streaming_trailing_metadata),
diff --git a/src/php/tests/unit_tests/ChannelTest.php b/src/php/tests/unit_tests/ChannelTest.php
index 4b35b1a28c..fa33d38911 100644
--- a/src/php/tests/unit_tests/ChannelTest.php
+++ b/src/php/tests/unit_tests/ChannelTest.php
@@ -99,7 +99,7 @@ class ChannelTest extends PHPUnit_Framework_TestCase
$this->channel = new Grpc\Channel('localhost:0',
['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$time = new Grpc\Timeval(1000);
- $state = $this->channel->watchConnectivityState(123, $time);
+ $state = $this->channel->watchConnectivityState(1, $time);
$this->assertTrue($state);
unset($time);
}
diff --git a/src/php/tests/unit_tests/ServerTest.php b/src/php/tests/unit_tests/ServerTest.php
index f2346ab113..5f40202f18 100644
--- a/src/php/tests/unit_tests/ServerTest.php
+++ b/src/php/tests/unit_tests/ServerTest.php
@@ -67,9 +67,9 @@ class ServerTest extends PHPUnit_Framework_TestCase
public function testRequestCall()
{
$this->server = new Grpc\Server();
- $port = $this->server->addHttp2Port('0.0.0.0:8888');
+ $port = $this->server->addHttp2Port('0.0.0.0:0');
$this->server->start();
- $channel = new Grpc\Channel('localhost:8888',
+ $channel = new Grpc\Channel('localhost:' . $port,
['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$deadline = Grpc\Timeval::infFuture();