Unverified Commit a32c2d03 authored by Paul Yang's avatar Paul Yang Committed by GitHub

Initialize well known type values (#6713)

* Initialize well known type values

Also fixes #6667

* Revert unwanted change
parent f4ceaecf
This diff is collapsed.
......@@ -5,6 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\RepeatedField;
use Google\Protobuf\GPBType;
use Foo\TestStringValue;
use Foo\TestAny;
use Foo\TestEnum;
use Foo\TestMessage;
......@@ -167,6 +168,14 @@ class EncodeDecodeTest extends TestBase
$this->assertSame("\"a\"", $m->serializeToJsonString());
}
public function testEncodeStringValue()
{
$m = new TestStringValue(['field' => new StringValue(['value' => ''])]);
var_dump($m->getField());
var_dump($m->serializeToJsonString());
$this->assertSame("{\"field\":\"\"}", $m->serializeToJsonString());
}
public function testDecodeTopLevelBytesValue()
{
$m = new BytesValue();
......
......@@ -31,6 +31,7 @@ require_once('generated/Foo/TestPackedMessage.php');
require_once('generated/Foo/TestPhpDoc.php');
require_once('generated/Foo/TestRandomFieldOrder.php');
require_once('generated/Foo/TestReverseFieldOrder.php');
require_once('generated/Foo/TestStringValue.php');
require_once('generated/Foo/TestUnpackedMessage.php');
require_once('generated/Foo/testLowerCaseMessage.php');
require_once('generated/Foo/testLowerCaseEnum.php');
......
syntax = "proto3";
import 'google/protobuf/any.proto';
import 'google/protobuf/wrappers.proto';
import 'google/protobuf/struct.proto';
import 'proto/test_include.proto';
import 'proto/test_no_namespace.proto';
......@@ -207,3 +208,7 @@ enum testLowerCaseEnum {
message TestAny {
google.protobuf.Any any = 1;
}
message TestStringValue {
google.protobuf.StringValue field = 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment