Skip to content

Commit

Permalink
minor changes. cannot assume hostname unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Jul 20, 2016
1 parent a3730b7 commit bae0cf1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 62 deletions.
3 changes: 2 additions & 1 deletion src/php/ext/grpc/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ zend_object_value create_wrapped_grpc_channel(zend_class_entry *class_type
return retval;
}

void php_grpc_read_args_array(zval *args_array, grpc_channel_args *args TSRMLS_DC) {
void php_grpc_read_args_array(zval *args_array,
grpc_channel_args *args TSRMLS_DC) {
HashTable *array_hash;
HashPosition array_pointer;
int args_index;
Expand Down
1 change: 0 additions & 1 deletion src/php/tests/unit_tests/CallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public function testAddSingleAndMultiValueMetadata()

public function testGetPeer()
{
$this->assertStringStartsWith('localhost:', $this->call->getPeer());
$this->assertTrue(is_string($this->call->getPeer()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/php/tests/unit_tests/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testGetTarget()
$this->channel = new Grpc\Channel('localhost:8888',
['credentials' => Grpc\ChannelCredentials::createInsecure()]);
$target = $this->channel->getTarget();
$this->assertSame('localhost:8888', $target);
$this->assertTrue(is_string($target));
}

public function testWatchConnectivityState()
Expand Down
60 changes: 1 addition & 59 deletions src/php/tests/unit_tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testRequestCall()
$this->assertObjectHasAttribute('method', $c);
$this->assertSame('dummy_method', $c->method);
$this->assertObjectHasAttribute('host', $c);
$this->assertSame('localhost:8888', $c->host);
$this->assertTrue(is_string($c->host));
$this->assertObjectHasAttribute('absolute_deadline', $c);
$this->assertObjectHasAttribute('metadata', $c);

Expand All @@ -100,55 +100,7 @@ private function createSslObj()

return $server_credentials;
}
/*
//TODO(thinkerou): make cases of addHttp2Port right
public function testAddHttp2Port()
{
$this->server = new Grpc\Server();
$port = $this->server->addHttp2Port('127.0.0.1:8080');
$this->assertEquals(8080, $port);
}
public function testAddHttp2Port1()
{
$this->server = new Grpc\Server([]);
$port = $this->server->addHttp2Port('127.0.0.1:8080');
$this->assertEquals(8080, $port);
}
public function testAddHttp2Port2()
{
$this->server = new Grpc\Server(['ip' => '127.0.0.1',
'port' => '8888', ]);
$port = $this->server->addHttp2Port('127.0.0.1:8080');
$this->assertEquals(8080, $port);
}

public function testAddSecureHttp2Port()
{
$this->server = new Grpc\Server();
$cred = $this->createSslObj();
$port = $this->server->addSecureHttp2Port('127.0.0.1:8080', $cred);
$this->assertEquals(8080, $port);
}
public function testAddSecureHttp2Port1()
{
$this->server = new Grpc\Server([]);
$cred = $this->createSslObj();
$port = $this->server->addSecureHttp2Port('127.0.0.1:8080', $cred);
$this->assertEquals(8080, $port);
}
public function testAddSecureHttp2Port2()
{
$this->server = new Grpc\Server(['ip' => '127.0.0.1',
'port' => '8888', ]);
$cred = $this->createSslObj();
$port = $this->server->addSecureHttp2Port('127.0.0.1:8080', $cred);
$this->assertEquals(8080, $port);
}
*/
/**
* @expectedException InvalidArgumentException
*/
Expand All @@ -158,16 +110,6 @@ public function testInvalidConstructor()
$this->assertNull($this->server);
}

/**
* @expectedException InvalidArgumentException
*/
/* public function testInvalidConstructor2()
{
//TODO(thinkerou): it crash when key is long on php7
$this->server = new Grpc\server(['0.0.0.0:0']);
$this->assertNull($this->server);
}
*/
/**
* @expectedException InvalidArgumentException
*/
Expand Down

0 comments on commit bae0cf1

Please sign in to comment.