aboutsummaryrefslogtreecommitdiff
path: root/php/tests/well_known_test.php
diff options
context:
space:
mode:
authorLeonard Hecker <leonard@hecker.io>2018-07-20 22:03:00 +0200
committerPaul Yang <TeBoring@users.noreply.github.com>2018-07-20 13:03:00 -0700
commite7746f487cb9cca685ffb1b3d7dccc5554b618a4 (patch)
tree851e32ef5032765a8ad61c30b212aefc5f12703a /php/tests/well_known_test.php
parent656f64ec0b5dff6816886d66a0124ab4f8d1fd4b (diff)
downloadprotobuf-e7746f487cb9cca685ffb1b3d7dccc5554b618a4.tar.gz
protobuf-e7746f487cb9cca685ffb1b3d7dccc5554b618a4.tar.bz2
protobuf-e7746f487cb9cca685ffb1b3d7dccc5554b618a4.zip
php: Added nanosecond support for Timestamp (#3972)
* php: Added nanosecond support for Timestamp * php: Fixed compatibility test
Diffstat (limited to 'php/tests/well_known_test.php')
-rw-r--r--php/tests/well_known_test.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/php/tests/well_known_test.php b/php/tests/well_known_test.php
index 1e8c4f42..9f2661fa 100644
--- a/php/tests/well_known_test.php
+++ b/php/tests/well_known_test.php
@@ -312,11 +312,12 @@ class WellKnownTest extends TestBase {
$from = new DateTime('2011-01-01T15:03:01.012345UTC');
$timestamp->fromDateTime($from);
$this->assertEquals($from->format('U'), $timestamp->getSeconds());
- $this->assertSame(0, $timestamp->getNanos());
+ $this->assertEquals(1000 * $from->format('u'), $timestamp->getNanos());
$to = $timestamp->toDateTime();
$this->assertSame(\DateTime::class, get_class($to));
$this->assertSame($from->format('U'), $to->format('U'));
+ $this->assertSame($from->format('u'), $to->format('u'));
}
public function testType()