aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/tests
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-09-05 14:10:32 -0700
committerGravatar GitHub <noreply@github.com>2017-09-05 14:10:32 -0700
commit7f8b91f552e80964d995712c26306410854d8ad1 (patch)
treed00ef6869c14f07672f75e23988a3ab1db20dbf7 /php/tests
parent35b852f5b84c4bd3cd49652e9473a001aa00d295 (diff)
Add native php support for Duration. (#3583)
Diffstat (limited to 'php/tests')
-rw-r--r--php/tests/well_known_test.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/php/tests/well_known_test.php b/php/tests/well_known_test.php
index 4441b13b..690ce5f5 100644
--- a/php/tests/well_known_test.php
+++ b/php/tests/well_known_test.php
@@ -5,6 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\GPBEmpty;
use Google\Protobuf\Any;
+use Google\Protobuf\Duration;
use Google\Protobuf\Timestamp;
use Foo\TestMessage;
@@ -107,4 +108,14 @@ class WellKnownTest extends TestBase {
$this->assertSame(\DateTime::class, get_class($to));
$this->assertSame($from->format('U'), $to->format('U'));
}
+
+ public function testDuration()
+ {
+ $duration = new Duration();
+
+ $duration->setSeconds(1);
+ $duration->setNanos(2);
+ $this->assertEquals(1, $duration->getSeconds());
+ $this->assertSame(2, $duration->getNanos());
+ }
}