Example #1
0
 protected function configDecodeJsonSimple()
 {
     $codecBin = new Protobuf\Codec\Binary();
     $codecJson = new Protobuf\Codec\Json();
     $bin = $this->configDecodeBinarySimple();
     $simple = $codecBin->decode(new test\Simple(), $bin[1]);
     $data = $codecJson->encode($simple);
     return array($codecJson, $data);
 }
Example #2
0
 function testMultiCodecMessageWithRepeatedFields()
 {
     $jsonCodec = new Codec\Json();
     $repeated = Protobuf\Protobuf::decode(Repeated::class, $this->bin_repeated_nested);
     $json = $jsonCodec->encode($repeated);
     $repeated = $jsonCodec->decode(new Repeated(), $json);
     $bin = Protobuf\Protobuf::encode($repeated);
     $this->assertEquals($bin, $this->bin_repeated_nested);
 }