aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests/unit_tests/EndToEndTest.php
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2015-08-13 09:39:04 -0700
committerGravatar Stanley Cheung <stanleycheung@google.com>2015-08-13 10:48:32 -0700
commit04b7a41d18744d2e882a486862ec2afb7433655f (patch)
tree63460f01d251f8bd957b6e252f0e3f4b354854b5 /src/php/tests/unit_tests/EndToEndTest.php
parent4c5c7b8647522fa9f21b33add09ae4b7d5ca6512 (diff)
php: add watchForReady method
Diffstat (limited to 'src/php/tests/unit_tests/EndToEndTest.php')
-rwxr-xr-xsrc/php/tests/unit_tests/EndToEndTest.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php
index df4cebc966..4c0cf91d51 100755
--- a/src/php/tests/unit_tests/EndToEndTest.php
+++ b/src/php/tests/unit_tests/EndToEndTest.php
@@ -175,7 +175,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{
$this->assertTrue($idle_state == Grpc\CHANNEL_IDLE);
$now = Grpc\Timeval::now();
- $delta = new Grpc\Timeval(100000);
+ $delta = new Grpc\Timeval(3000000); // should finish well before
$deadline = $now->add($delta);
$this->assertTrue($this->channel->watchConnectivityState(
@@ -184,4 +184,19 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{
$new_state = $this->channel->getConnectivityState();
$this->assertTrue($idle_state != $new_state);
}
+
+ public function testWatchConnectivityStateDoNothing() {
+ $idle_state = $this->channel->getConnectivityState();
+ $this->assertTrue($idle_state == Grpc\CHANNEL_IDLE);
+
+ $now = Grpc\Timeval::now();
+ $delta = new Grpc\Timeval(100000);
+ $deadline = $now->add($delta);
+
+ $this->assertFalse($this->channel->watchConnectivityState(
+ $idle_state, $deadline));
+
+ $new_state = $this->channel->getConnectivityState();
+ $this->assertTrue($new_state == Grpc\CHANNEL_IDLE);
+ }
}