aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/tests/unit_tests/TimevalTest.php
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-19 15:37:43 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-19 15:37:43 -0700
commit85207d5a25d90ef001d63b7fac127132d85bc59e (patch)
treebc1482f4de79bcd04c50963d41fadb68d6518659 /src/php/tests/unit_tests/TimevalTest.php
parent4efb6966bdfb62c725c6614b0d85ea374250bb51 (diff)
parentf3fac562e8994631484f77ad8b0c6c17582699a8 (diff)
Merge github.com:grpc/grpc into flow-like-lava-to-a-barnyard
Diffstat (limited to 'src/php/tests/unit_tests/TimevalTest.php')
-rwxr-xr-xsrc/php/tests/unit_tests/TimevalTest.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/php/tests/unit_tests/TimevalTest.php b/src/php/tests/unit_tests/TimevalTest.php
index a8bfcf0ac4..7b4925cad6 100755
--- a/src/php/tests/unit_tests/TimevalTest.php
+++ b/src/php/tests/unit_tests/TimevalTest.php
@@ -61,4 +61,26 @@ class TimevalTest extends PHPUnit_Framework_TestCase{
$this->assertLessThan(0, Grpc\Timeval::compare($zero, $now));
$this->assertLessThan(0, Grpc\Timeval::compare($now, $future));
}
+
+ public function testNowAndAdd() {
+ $now = Grpc\Timeval::now();
+ $delta = new Grpc\Timeval(1000);
+ $deadline = $now->add($delta);
+ $this->assertGreaterThan(0, Grpc\Timeval::compare($deadline, $now));
+ }
+
+ public function testNowAndSubtract() {
+ $now = Grpc\Timeval::now();
+ $delta = new Grpc\Timeval(1000);
+ $deadline = $now->subtract($delta);
+ $this->assertLessThan(0, Grpc\Timeval::compare($deadline, $now));
+ }
+
+ 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));
+ }
}