File tree Expand file tree Collapse file tree 3 files changed +39
-6
lines changed
Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 1+ syntax = "proto3" ;
2+
3+ import 'google/protobuf/any.proto';
4+ import 'google/protobuf/wrappers.proto';
5+ import 'google/protobuf/struct.proto';
6+
7+ package foo.errors ;
8+
9+ message AuthenticationErrorEnum {
10+ enum AuthenticationError {
11+ UNSPECIFIED = 0 ;
12+ UNKNOWN = 1 ;
13+ AUTHENTICATION_ERROR = 2 ;
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ syntax = "proto3" ;
2+
3+ import 'google/protobuf/any.proto';
4+ import 'google/protobuf/wrappers.proto';
5+ import 'google/protobuf/struct.proto';
6+ import 'proto/errors/authentication_error.proto';
7+
8+ package foo.errors ;
9+
10+ message ErrorCode {
11+ oneof error_code {
12+ AuthenticationErrorEnum.AuthenticationError authentication_error = 1 ;
13+ }
14+ }
Original file line number Diff line number Diff line change 55
66use Google \Protobuf \RepeatedField ;
77use Google \Protobuf \GPBType ;
8+ use Foo \Errors \ErrorCode ;
9+ use Foo \Errors \AuthenticationErrorEnum \AuthenticationError ;
810use Foo \TestInt32Value ;
911use Foo \TestInt64Value ;
1012use Foo \TestUInt32Value ;
3739
3840class EncodeDecodeTest extends TestBase
3941{
42+ public function testIssue3 ()
43+ {
44+ $ m = new ErrorCode ([
45+ 'authentication_error ' => AuthenticationError::AUTHENTICATION_ERROR
46+ ]);
47+ $ this ->assertSame ('{"authenticationError":"AUTHENTICATION_ERROR"} ' , $ m ->serializeToJsonString ());
48+ }
49+
4050 public function testDecodeJsonSimple ()
4151 {
4252 $ m = new TestMessage ();
@@ -326,12 +336,6 @@ public function testEncodeDecodeOneof()
326336
327337 }
328338
329- public function testJsonEncodeEnumFromInitializer ()
330- {
331- $ m = new TestMessage (['oneof_enum ' => TestEnum::TWO ]);
332- $ this ->assertSame ('{"oneofEnum":"TWO"} ' , $ m ->serializeToJsonString ());
333- }
334-
335339 public function testJsonEncodeDecodeOneof ()
336340 {
337341 $ m = new TestMessage ();
You can’t perform that action at this time.
0 commit comments