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::infFuture()); } public function testAddEmptyMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => [], ]; $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } public function testAddSingleMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value']], ]; $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } public function testAddMultiValueMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key' => ['value1', 'value2']], ]; $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } public function testAddSingleAndMultiValueMetadata() { $batch = [ Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], 'key2' => ['value2', 'value3'], ], ]; $result = $this->call->startBatch($batch); $this->assertTrue($result->send_metadata); } public function testGetPeer() { $this->assertTrue(is_string($this->call->getPeer())); } }