Merge pull request #3017 from stanley-cheung/php_update_gen_code_test

PHP: update codegen, client now extends basestub
pull/3024/head
Michael Lumish 9 years ago
commit 0ea28f1ca5
  1. 8
      src/php/tests/generated_code/AbstractGeneratedCodeTest.php
  2. 4
      src/php/tests/generated_code/GeneratedCodeTest.php
  3. 4
      src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php

@ -39,6 +39,14 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase {
protected static $client; protected static $client;
protected static $timeout; protected static $timeout;
public function testWaitForNotReady() {
$this->assertFalse(self::$client->waitForReady(1));
}
public function testWaitForReady() {
$this->assertTrue(self::$client->waitForReady(250000));
}
public function testSimpleRequest() { public function testSimpleRequest() {
$div_arg = new math\DivArgs(); $div_arg = new math\DivArgs();
$div_arg->setDividend(7); $div_arg->setDividend(7);

@ -35,7 +35,7 @@ require 'AbstractGeneratedCodeTest.php';
class GeneratedCodeTest extends AbstractGeneratedCodeTest { class GeneratedCodeTest extends AbstractGeneratedCodeTest {
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
self::$client = new math\MathClient(new Grpc\BaseStub( self::$client = new math\MathClient(
getenv('GRPC_TEST_HOST'), [])); getenv('GRPC_TEST_HOST'), []);
} }
} }

@ -35,13 +35,13 @@ require 'AbstractGeneratedCodeTest.php';
class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest { class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest {
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
self::$client = new math\MathClient(new Grpc\BaseStub( self::$client = new math\MathClient(
getenv('GRPC_TEST_HOST'), ['update_metadata' => getenv('GRPC_TEST_HOST'), ['update_metadata' =>
function($a_hash, function($a_hash,
$client = array()) { $client = array()) {
$a_copy = $a_hash; $a_copy = $a_hash;
$a_copy['foo'] = ['bar']; $a_copy['foo'] = ['bar'];
return $a_copy; return $a_copy;
}])); }]);
} }
} }

Loading…
Cancel
Save