コード例 #1
0
ファイル: TimevalTest.php プロジェクト: aytacozkan/grpc
 /**
  * @depends testFutureIsGreaterThanZero
  */
 public function testNowIsBetweenZeroAndFuture()
 {
     $zero = Grpc\Timeval::zero();
     $future = Grpc\Timeval::infFuture();
     $now = Grpc\Timeval::now();
     $this->assertLessThan(0, Grpc\Timeval::compare($zero, $now));
     $this->assertLessThan(0, Grpc\Timeval::compare($now, $future));
 }
コード例 #2
0
ファイル: TimevalTest.php プロジェクト: nkibler/grpc
 public function testAddAndSubtract()
 {
     $now = Grpc\Timeval::now();
     $delta = new Grpc\Timeval(1000);
     $deadline = $now->add($delta);
     $back_to_now = $deadline->subtract($delta);
     $this->assertSame(0, Grpc\Timeval::compare($back_to_now, $now));
 }
コード例 #3
0
ファイル: TimevalTest.php プロジェクト: kriswuollett/grpc
 /**
  * @expectedException InvalidArgumentException
  */
 public function testSubtractInvalidParam()
 {
     $a = Grpc\Timeval::now();
     $a->subtract(1000);
 }
コード例 #4
0
 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);
 }