diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2017-11-06 18:51:03 +0100 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2017-11-06 19:41:44 +0100 |
commit | 18f02d204985081fd73fcd4a3d250d55f9e7317d (patch) | |
tree | 212c9c57d27acb452b4030146c4c18a80d54f1f7 /src/php/tests | |
parent | e5bca395f9bd9e6c017db3fd318ec608b5289341 (diff) |
fix php testWatchConnectivityState
Diffstat (limited to 'src/php/tests')
-rw-r--r-- | src/php/tests/unit_tests/ChannelTest.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/php/tests/unit_tests/ChannelTest.php b/src/php/tests/unit_tests/ChannelTest.php index c375a16269..13a770caff 100644 --- a/src/php/tests/unit_tests/ChannelTest.php +++ b/src/php/tests/unit_tests/ChannelTest.php @@ -81,10 +81,14 @@ class ChannelTest extends PHPUnit_Framework_TestCase { $this->channel = new Grpc\Channel('localhost:0', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); - $time = new Grpc\Timeval(1000); - $state = $this->channel->watchConnectivityState(1, $time); + $now = Grpc\Timeval::now(); + $deadline = $now->add(new Grpc\Timeval(100*1000)); // 100ms + // we act as if 'CONNECTING'(=1) was the last state + // we saw, so the default state of 'IDLE' should be delivered instantly + $state = $this->channel->watchConnectivityState(1, $deadline); $this->assertTrue($state); - unset($time); + unset($now); + unset($deadline); } public function testClose() |