Add tests for allowing dots in metadata keys

pull/19232/head
Stanley Cheung 6 years ago
parent e8cb29dd1e
commit c43b77b738
  1. 29
      src/php/tests/generated_code/AbstractGeneratedCodeTest.php

@ -71,6 +71,33 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
$call = self::$client->Div($div_arg, [' ' => 'abc123']); $call = self::$client->Div($div_arg, [' ' => 'abc123']);
} }
public function testMetadata()
{
$div_arg = new Math\DivArgs();
$call = self::$client->Div($div_arg, ['somekey' => ['abc123']]);
}
public function testMetadataKey()
{
$div_arg = new Math\DivArgs();
$call = self::$client->Div($div_arg, ['somekey_-1' => ['abc123']]);
}
public function testMetadataKeyWithDot()
{
$div_arg = new Math\DivArgs();
$call = self::$client->Div($div_arg, ['someKEY._-1' => ['abc123']]);
}
/**
* @expectedException InvalidArgumentException
*/
public function testMetadataInvalidKey()
{
$div_arg = new Math\DivArgs();
$call = self::$client->Div($div_arg, ['(somekey)' => ['abc123']]);
}
public function testGetCallMetadata() public function testGetCallMetadata()
{ {
$div_arg = new Math\DivArgs(); $div_arg = new Math\DivArgs();
@ -81,6 +108,8 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase
public function testTimeout() public function testTimeout()
{ {
$div_arg = new Math\DivArgs(); $div_arg = new Math\DivArgs();
$div_arg->setDividend(7);
$div_arg->setDivisor(4);
$call = self::$client->Div($div_arg, [], ['timeout' => 1]); $call = self::$client->Div($div_arg, [], ['timeout' => 1]);
list($response, $status) = $call->wait(); list($response, $status) = $call->wait();
$this->assertSame(\Grpc\STATUS_DEADLINE_EXCEEDED, $status->code); $this->assertSame(\Grpc\STATUS_DEADLINE_EXCEEDED, $status->code);

Loading…
Cancel
Save