|
|
@ -175,7 +175,7 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ |
|
|
|
$this->assertTrue($idle_state == Grpc\CHANNEL_IDLE); |
|
|
|
$this->assertTrue($idle_state == Grpc\CHANNEL_IDLE); |
|
|
|
|
|
|
|
|
|
|
|
$now = Grpc\Timeval::now(); |
|
|
|
$now = Grpc\Timeval::now(); |
|
|
|
$delta = new Grpc\Timeval(100000); |
|
|
|
$delta = new Grpc\Timeval(3000000); // should finish well before |
|
|
|
$deadline = $now->add($delta); |
|
|
|
$deadline = $now->add($delta); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($this->channel->watchConnectivityState( |
|
|
|
$this->assertTrue($this->channel->watchConnectivityState( |
|
|
@ -184,4 +184,19 @@ class EndToEndTest extends PHPUnit_Framework_TestCase{ |
|
|
|
$new_state = $this->channel->getConnectivityState(); |
|
|
|
$new_state = $this->channel->getConnectivityState(); |
|
|
|
$this->assertTrue($idle_state != $new_state); |
|
|
|
$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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|