public function testOneofField()
 {
     $m = new TestMessage();
     $m->setOneofInt32(1);
     $this->assertSame(1, $m->getOneofInt32());
     $this->assertSame(0.0, $m->getOneofFloat());
     $this->assertSame('', $m->getOneofString());
     $this->assertSame(NULL, $m->getOneofMessage());
     $m->setOneofFloat(2.0);
     $this->assertSame(0, $m->getOneofInt32());
     $this->assertSame(2.0, $m->getOneofFloat());
     $this->assertSame('', $m->getOneofString());
     $this->assertSame(NULL, $m->getOneofMessage());
     $m->setOneofString('abc');
     $this->assertSame(0, $m->getOneofInt32());
     $this->assertSame(0.0, $m->getOneofFloat());
     $this->assertSame('abc', $m->getOneofString());
     $this->assertSame(NULL, $m->getOneofMessage());
     $sub_m = new TestMessage_Sub();
     $sub_m->setA(1);
     $m->setOneofMessage($sub_m);
     $this->assertSame(0, $m->getOneofInt32());
     $this->assertSame(0.0, $m->getOneofFloat());
     $this->assertSame('', $m->getOneofString());
     $this->assertSame(1, $m->getOneofMessage()->getA());
 }
$n->decode($data);
assert(1 === $n->getOneofInt32());
$m->setOneofFloat(2.0);
assert(0 === $m->getOneofInt32());
assert(2.0 === $m->getOneofFloat());
assert('' === $m->getOneofString());
assert(NULL === $m->getOneofMessage());
$data = $m->encode();
$n = new TestMessage();
$n->decode($data);
assert(2.0 === $n->getOneofFloat());
$m->setOneofString('abc');
assert(0 === $m->getOneofInt32());
assert(0.0 === $m->getOneofFloat());
assert('abc' === $m->getOneofString());
assert(NULL === $m->getOneofMessage());
$data = $m->encode();
$n = new TestMessage();
$n->decode($data);
assert('abc' === $n->getOneofString());
$sub_m = new TestMessage_Sub();
$sub_m->setA(1);
$m->setOneofMessage($sub_m);
assert(0 === $m->getOneofInt32());
assert(0.0 === $m->getOneofFloat());
assert('' === $m->getOneofString());
assert(1 === $m->getOneofMessage()->getA());
$data = $m->encode();
$n = new TestMessage();
$n->decode($data);
assert(1 === $n->getOneofMessage()->getA());