diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-12-15 10:36:07 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 10:36:07 -0800 |
commit | c79ba5c1b6187d1a6eb1e771976483a9a7b6a434 (patch) | |
tree | 515176992b31a28bebe3843cd30d73748763a85a /php/tests | |
parent | 269884a1eb7a1d19d38cf8e61fa436ee8b7849f9 (diff) | |
parent | 8d6f13e86d62b47570810371a6c0528cfb10b781 (diff) | |
download | protobuf-c79ba5c1b6187d1a6eb1e771976483a9a7b6a434.tar.gz protobuf-c79ba5c1b6187d1a6eb1e771976483a9a7b6a434.tar.bz2 protobuf-c79ba5c1b6187d1a6eb1e771976483a9a7b6a434.zip |
Merge pull request #4034 from TeBoring/php-timestamp-bug
Avoid calling method from php extension directly
Diffstat (limited to 'php/tests')
-rw-r--r-- | php/tests/memory_leak_test.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 8ea84f68..507635e7 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -126,6 +126,18 @@ $from = new \Google\Protobuf\Timestamp(); $from->setSeconds(1); assert(1, $from->getSeconds()); +$timestamp = new \Google\Protobuf\Timestamp(); + +date_default_timezone_set('UTC'); +$from = new DateTime('2011-01-01T15:03:01.012345UTC'); +$timestamp->fromDateTime($from); +assert($from->format('U') == $timestamp->getSeconds()); +assert(0 == $timestamp->getNanos()); + +$to = $timestamp->toDateTime(); +assert(\DateTime::class == get_class($to)); +assert($from->format('U') == $to->format('U')); + $from = new \Google\Protobuf\Value(); $from->setNumberValue(1); assert(1, $from->getNumberValue()); |