Unverified Commit 585b24e9 authored by Joshua Haberman's avatar Joshua Haberman Committed by GitHub

Merge pull request #5032 from TeBoring/json-wrapper

Fix json parsing of wrapper values
parents ba8692fb e3ee7167
......@@ -63,44 +63,8 @@ Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
Required.Proto3.JsonInput.OneofFieldDuplicate
Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalBytesWrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalDoubleWrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalFloatWrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalInt32Wrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalInt64Wrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalStringWrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalUint32Wrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedInt32Wrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedInt64Wrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedStringWrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedUint32Wrapper.ProtobufOutput
Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput
Required.Proto3.JsonInput.StringFieldEscape.JsonOutput
Required.Proto3.JsonInput.StringFieldEscape.ProtobufOutput
Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput
......
This diff is collapsed.
......@@ -11,9 +11,90 @@ use Foo\TestMessage\Sub;
use Foo\TestPackedMessage;
use Foo\TestRandomFieldOrder;
use Foo\TestUnpackedMessage;
use Google\Protobuf\DoubleValue;
use Google\Protobuf\FloatValue;
use Google\Protobuf\Int32Value;
use Google\Protobuf\UInt32Value;
use Google\Protobuf\Int64Value;
use Google\Protobuf\UInt64Value;
use Google\Protobuf\BoolValue;
use Google\Protobuf\StringValue;
use Google\Protobuf\BytesValue;
class EncodeDecodeTest extends TestBase
{
public function testDecodeJsonSimple()
{
$m = new TestMessage();
$m->mergeFromJsonString("{\"optionalInt32\":1}");
}
public function testDecodeTopLevelBoolValue()
{
$m = new BoolValue();
$m->mergeFromJsonString("true");
$this->assertEquals(true, $m->getValue());
$m->mergeFromJsonString("false");
$this->assertEquals(false, $m->getValue());
}
public function testDecodeTopLevelDoubleValue()
{
$m = new DoubleValue();
$m->mergeFromJsonString("1.5");
$this->assertEquals(1.5, $m->getValue());
}
public function testDecodeTopLevelFloatValue()
{
$m = new FloatValue();
$m->mergeFromJsonString("1.5");
$this->assertEquals(1.5, $m->getValue());
}
public function testDecodeTopLevelInt32Value()
{
$m = new Int32Value();
$m->mergeFromJsonString("1");
$this->assertEquals(1, $m->getValue());
}
public function testDecodeTopLevelUInt32Value()
{
$m = new UInt32Value();
$m->mergeFromJsonString("1");
$this->assertEquals(1, $m->getValue());
}
public function testDecodeTopLevelInt64Value()
{
$m = new Int64Value();
$m->mergeFromJsonString("1");
$this->assertEquals(1, $m->getValue());
}
public function testDecodeTopLevelUInt64Value()
{
$m = new UInt64Value();
$m->mergeFromJsonString("1");
$this->assertEquals(1, $m->getValue());
}
public function testDecodeTopLevelStringValue()
{
$m = new StringValue();
$m->mergeFromJsonString("\"a\"");
$this->assertSame("a", $m->getValue());
}
public function testDecodeTopLevelBytesValue()
{
$m = new BytesValue();
$m->mergeFromJsonString("\"YQ==\"");
$this->assertSame("a", $m->getValue());
}
public function testEncode()
{
......
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