From 7f8b91f552e80964d995712c26306410854d8ad1 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 5 Sep 2017 14:10:32 -0700 Subject: Add native php support for Duration. (#3583) --- php/tests/well_known_test.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'php/tests') 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()); + } } -- cgit v1.2.3