diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index 413d5966e13eee918186091c0bdb85f8da6c3056..1add9725890bb1bf779f72972bd18c7c17470dc2 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -45,7 +45,7 @@ abstract class AbstractCall { * @param string $method The method to call on the remote server */ public function __construct(Channel $channel, $method, $deserialize) { - $this->call = new Call($channel, $method, Timeval::inf_future()); + $this->call = new Call($channel, $method, Timeval::infFuture()); $this->deserialize = $deserialize; $this->metadata = null; } diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index 2afceafce9e23657cf6426260e5398bcc58c572f..76c642bef469ff0398eda75febc22066f192057f 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -43,7 +43,7 @@ class BidiStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($metadata) { - $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + $this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]); } /** @@ -55,7 +55,7 @@ class BidiStreamingCall extends AbstractCall { if ($this->metadata === null) { $batch[OP_RECV_INITIAL_METADATA] = true; } - $read_event = $this->call->start_batch($batch); + $read_event = $this->call->startBatch($batch); if ($this->metadata === null) { $this->metadata = $read_event->metadata; } @@ -68,14 +68,14 @@ class BidiStreamingCall extends AbstractCall { * @param ByteBuffer $data The data to write */ public function write($data) { - $this->call->start_batch([OP_SEND_MESSAGE => $data->serialize()]); + $this->call->startBatch([OP_SEND_MESSAGE => $data->serialize()]); } /** * Indicate that no more writes will be sent. */ public function writesDone() { - $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->call->startBatch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -84,7 +84,7 @@ class BidiStreamingCall extends AbstractCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->call->start_batch([ + $status_event = $this->call->startBatch([ OP_RECV_STATUS_ON_CLIENT => true ]); return $status_event->status; diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index ec585da985603a2a4990247a7157e90a79aec28b..61439d3f475fe8f04fc82fd11cd5871748d94f17 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -44,11 +44,11 @@ class ClientStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg_iter, $metadata = array()) { - $event = $this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); + $event = $this->call->startBatch([OP_SEND_INITIAL_METADATA => $metadata]); foreach($arg_iter as $arg) { - $this->call->start_batch([OP_SEND_MESSAGE => $arg->serialize()]); + $this->call->startBatch([OP_SEND_MESSAGE => $arg->serialize()]); } - $this->call->start_batch([OP_SEND_CLOSE_FROM_CLIENT => true]); + $this->call->startBatch([OP_SEND_CLOSE_FROM_CLIENT => true]); } /** @@ -56,7 +56,7 @@ class ClientStreamingCall extends AbstractCall { * @return [response data, status] */ public function wait() { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_RECV_INITIAL_METADATA => true, OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true]); diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 574c1bb1e028e981d41873e4bc2736abcdb50821..631c863345b7dfb4bdd36be85c0b6724cffb5e4d 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -44,7 +44,7 @@ class ServerStreamingCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg, $metadata = array()) { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $arg->serialize(), @@ -56,10 +56,10 @@ class ServerStreamingCall extends AbstractCall { * @return An iterator of response values */ public function responses() { - $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message; while($response !== null) { yield $this->deserializeResponse($response); - $response = $this->call->start_batch([OP_RECV_MESSAGE => true])->message; + $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message; } } @@ -69,7 +69,7 @@ class ServerStreamingCall extends AbstractCall { * and array $metadata members */ public function getStatus() { - $status_event = $this->call->start_batch([ + $status_event = $this->call->startBatch([ OP_RECV_STATUS_ON_CLIENT => true ]); return $status_event->status; diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 814d477697accf61ea2d6c536e592160dd5fbae1..97a10a40f4955d2ff8a19d9c50a877a8c8404345 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -44,7 +44,7 @@ class UnaryCall extends AbstractCall { * @param array $metadata Metadata to send with the call, if applicable */ public function start($arg, $metadata = array()) { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $arg->serialize(), @@ -57,7 +57,7 @@ class UnaryCall extends AbstractCall { * @return [response data, status] */ public function wait() { - $event = $this->call->start_batch([ + $event = $this->call->startBatch([ OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true]); return array($this->deserializeResponse($event->message), $event->status); diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index d361ce0030d6eea85237ae0a059a6da884731662..77a2d86ce4cb5896a0812126d3f8df98f175d604 100755 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -37,21 +37,21 @@ class CallTest extends PHPUnit_Framework_TestCase{ public static function setUpBeforeClass() { self::$server = new Grpc\Server([]); - self::$port = self::$server->add_http2_port('0.0.0.0:0'); + self::$port = self::$server->addHttp2Port('0.0.0.0:0'); } public function setUp() { $this->channel = new Grpc\Channel('localhost:' . self::$port, []); $this->call = new Grpc\Call($this->channel, '/foo', - Grpc\Timeval::inf_future()); + Grpc\Timeval::infFuture()); } public function testAddEmptyMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => [] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -59,7 +59,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -67,7 +67,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value1', 'value2']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } @@ -76,7 +76,7 @@ class CallTest extends PHPUnit_Framework_TestCase{ Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], 'key2' => ['value2', 'value3']] ]; - $result = $this->call->start_batch($batch); + $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } } diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 3e165b7213dbc98e1b63441a5c2fa225ad5363c3..296873fa8f76e942f95a1c784291ac09722b8f0b 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -34,7 +34,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ public function setUp() { $this->server = new Grpc\Server([]); - $port = $this->server->add_http2_port('0.0.0.0:0'); + $port = $this->server->addHttp2Port('0.0.0.0:0'); $this->channel = new Grpc\Channel('localhost:' . $port, []); $this->server->start(); } @@ -45,13 +45,13 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ } public function testSimpleRequestBody() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true ]); @@ -59,12 +59,12 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_metadata); $this->assertTrue($event->send_close); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $this->assertSame([], $event->metadata); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_STATUS_FROM_SERVER => [ 'metadata' => [], @@ -78,7 +78,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertFalse($event->cancelled); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true ]); @@ -94,7 +94,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ } public function testClientServerFullRequestResponse() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $req_text = 'client_server_full_request_response'; $reply_text = 'reply:client_server_full_request_response'; $status_text = 'status:client_server_full_response_text'; @@ -103,7 +103,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, Grpc\OP_SEND_MESSAGE => $req_text @@ -113,11 +113,11 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_close); $this->assertTrue($event->send_message); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_MESSAGE => $reply_text, Grpc\OP_SEND_STATUS_FROM_SERVER => [ @@ -135,7 +135,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertFalse($event->cancelled); $this->assertSame($req_text, $event->message); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_MESSAGE => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true, diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index 2d62fe9d5e6bf56b80cf6a5be45d2ef32e3fa225..0c18cd3e91a88fea6d783f0b42daa08c42a803e2 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -40,8 +40,8 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ file_get_contents(dirname(__FILE__) . '/../data/server1.key'), file_get_contents(dirname(__FILE__) . '/../data/server1.pem')); $this->server = new Grpc\Server(); - $port = $this->server->add_secure_http2_port('0.0.0.0:0', - $server_credentials); + $port = $this->server->addSecureHttp2Port('0.0.0.0:0', + $server_credentials); $this->server->start(); $this->channel = new Grpc\Channel( 'localhost:' . $port, @@ -57,13 +57,13 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ } public function testSimpleRequestBody() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true ]); @@ -71,12 +71,12 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_metadata); $this->assertTrue($event->send_close); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $this->assertSame([], $event->metadata); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_STATUS_FROM_SERVER => [ 'metadata' => [], @@ -90,7 +90,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_status); $this->assertFalse($event->cancelled); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true ]); @@ -106,7 +106,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ } public function testClientServerFullRequestResponse() { - $deadline = Grpc\Timeval::inf_future(); + $deadline = Grpc\Timeval::infFuture(); $req_text = 'client_server_full_request_response'; $reply_text = 'reply:client_server_full_request_response'; $status_text = 'status:client_server_full_response_text'; @@ -115,7 +115,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ 'dummy_method', $deadline); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, Grpc\OP_SEND_MESSAGE => $req_text @@ -125,11 +125,11 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertTrue($event->send_close); $this->assertTrue($event->send_message); - $event = $this->server->request_call(); + $event = $this->server->requestCall(); $this->assertSame('dummy_method', $event->method); $server_call = $event->call; - $event = $server_call->start_batch([ + $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_MESSAGE => $reply_text, Grpc\OP_SEND_STATUS_FROM_SERVER => [ @@ -147,7 +147,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ $this->assertFalse($event->cancelled); $this->assertSame($req_text, $event->message); - $event = $call->start_batch([ + $event = $call->startBatch([ Grpc\OP_RECV_INITIAL_METADATA => true, Grpc\OP_RECV_MESSAGE => true, Grpc\OP_RECV_STATUS_ON_CLIENT => true, diff --git a/src/php/tests/unit_tests/TimevalTest.php b/src/php/tests/unit_tests/TimevalTest.php index d20069afa11eb1a8ff1f3c76a6178f7f167ebdce..a8bfcf0ac454463e895e8180440ed05912e265e9 100755 --- a/src/php/tests/unit_tests/TimevalTest.php +++ b/src/php/tests/unit_tests/TimevalTest.php @@ -39,14 +39,14 @@ class TimevalTest extends PHPUnit_Framework_TestCase{ public function testPastIsLessThanZero() { $zero = Grpc\Timeval::zero(); - $past = Grpc\Timeval::inf_past(); + $past = Grpc\Timeval::infPast(); $this->assertLessThan(0, Grpc\Timeval::compare($past, $zero)); $this->assertGreaterThan(0, Grpc\Timeval::compare($zero, $past)); } public function testFutureIsGreaterThanZero() { $zero = Grpc\Timeval::zero(); - $future = Grpc\Timeval::inf_future(); + $future = Grpc\Timeval::infFuture(); $this->assertLessThan(0, Grpc\Timeval::compare($zero, $future)); $this->assertGreaterThan(0, Grpc\Timeval::compare($future, $zero)); } @@ -56,7 +56,7 @@ class TimevalTest extends PHPUnit_Framework_TestCase{ */ public function testNowIsBetweenZeroAndFuture() { $zero = Grpc\Timeval::zero(); - $future = Grpc\Timeval::inf_future(); + $future = Grpc\Timeval::infFuture(); $now = Grpc\Timeval::now(); $this->assertLessThan(0, Grpc\Timeval::compare($zero, $now)); $this->assertLessThan(0, Grpc\Timeval::compare($now, $future));