|
|
|
@ -5,6 +5,7 @@ require_once('test_util.php'); |
|
|
|
|
|
|
|
|
|
use Google\Protobuf\RepeatedField; |
|
|
|
|
use Google\Protobuf\GPBType; |
|
|
|
|
use Foo\EmptyAnySerialization; |
|
|
|
|
use Foo\TestInt32Value; |
|
|
|
|
use Foo\TestInt64Value; |
|
|
|
|
use Foo\TestUInt32Value; |
|
|
|
@ -1513,4 +1514,22 @@ class EncodeDecodeTest extends TestBase |
|
|
|
|
[TestStringValue::class, "a", "\"a\"", "", "\"\""], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testEmptyAnySerialization() |
|
|
|
|
{ |
|
|
|
|
$m = new EmptyAnySerialization(); |
|
|
|
|
|
|
|
|
|
$any = new Any(); |
|
|
|
|
$any->pack($m); |
|
|
|
|
|
|
|
|
|
$data = $any->serializeToJsonString(); |
|
|
|
|
$this->assertEquals('{"@type":"type.googleapis.com/foo.EmptyAnySerialization"}', $data); |
|
|
|
|
|
|
|
|
|
$any = new Any(); |
|
|
|
|
$any->mergeFromJsonString($data); |
|
|
|
|
|
|
|
|
|
$m = $any->unpack(); |
|
|
|
|
$this->assertInstanceOf(EmptyAnySerialization::class, $m); |
|
|
|
|
$this->assertEquals('', $m->getA()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|