aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/tests
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2017-12-12 13:57:49 -0800
committerGravatar Bo Yang <teboring@google.com>2017-12-12 13:57:49 -0800
commit88102eae8f86045307e9d46ad900f91158227f2b (patch)
tree460f40dde0a53279d9722d6e712410e99e0f5e93 /php/tests
parent9f6aceaa8ce8250d9e36225180c218035bd49fe9 (diff)
Replace private timelib_update_ts with public date_timestamp_get
Diffstat (limited to 'php/tests')
-rw-r--r--php/tests/memory_leak_test.php12
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..ce268838 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());