diff options
author | Bo Yang <paulyang1211@gmail.com> | 2017-12-11 10:50:50 -0800 |
---|---|---|
committer | Bo Yang <paulyang1211@gmail.com> | 2017-12-11 10:50:50 -0800 |
commit | fc5818b2bbe48f6720410d448c3f5e4afb6bd365 (patch) | |
tree | 6e011c12db409e16767463f0d53aec5ef104bcc6 /php/tests/memory_leak_test.php | |
parent | cf7c15e31a456f634d4e3deaf4ef74a6bfad825d (diff) | |
parent | 457f6a607ce167132b833c049b0eaf3a9c4b3f5f (diff) | |
download | protobuf-fc5818b2bbe48f6720410d448c3f5e4afb6bd365.tar.gz protobuf-fc5818b2bbe48f6720410d448c3f5e4afb6bd365.tar.bz2 protobuf-fc5818b2bbe48f6720410d448c3f5e4afb6bd365.zip |
Merge branch '3.5.0.1' into 3.5.x
Diffstat (limited to 'php/tests/memory_leak_test.php')
-rw-r--r-- | php/tests/memory_leak_test.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index 772b466f..8ea84f68 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -50,7 +50,8 @@ $to->mergeFromString($data); TestUtil::assertTestMessage($to); -$from->setRecursive($from); +// TODO(teboring): This causes following tests fail in php7. +# $from->setRecursive($from); $arr = new RepeatedField(GPBType::MESSAGE, TestMessage::class); $arr[] = new TestMessage; @@ -106,15 +107,34 @@ $m->mergeFromString(hex2bin('F80601')); assert('F80601', bin2hex($m->serializeToString())); // Test create repeated field via array. -$str_arr = array(); +$str_arr = array("abc"); $m = new TestMessage(); $m->setRepeatedString($str_arr); // Test create map field via array. -$str_arr = array(); +$str_arr = array("abc"=>"abc"); $m = new TestMessage(); $m->setMapStringString($str_arr); +// Test unset +$from = new TestMessage(); +TestUtil::setTestMessage($from); +unset($from); + +// Test wellknown +$from = new \Google\Protobuf\Timestamp(); +$from->setSeconds(1); +assert(1, $from->getSeconds()); + +$from = new \Google\Protobuf\Value(); +$from->setNumberValue(1); +assert(1, $from->getNumberValue()); + +// Test descriptor +$pool = \Google\Protobuf\DescriptorPool::getGeneratedPool(); +$desc = $pool->getDescriptorByClassName("\Foo\TestMessage"); +$field = $desc->getField(1); + # $from = new TestMessage(); # $to = new TestMessage(); # TestUtil::setTestMessage($from); |