| 70 | } |
| 71 | |
| 72 | public function testRecordNullField() |
| 73 | { |
| 74 | $schema_json = <<<_JSON |
| 75 | {"name":"member", |
| 76 | "type":"record", |
| 77 | "fields":[{"name":"one", "type":"int"}, |
| 78 | {"name":"two", "type":["null", "string"]} |
| 79 | ]} |
| 80 | _JSON; |
| 81 | |
| 82 | $schema = AvroSchema::parse($schema_json); |
| 83 | $datum = array("one" => 1); |
| 84 | |
| 85 | $io = new AvroStringIO(); |
| 86 | $writer = new AvroIODatumWriter($schema); |
| 87 | $encoder = new AvroIOBinaryEncoder($io); |
| 88 | $writer->write($datum, $encoder); |
| 89 | $bin = $io->string(); |
| 90 | |
| 91 | $this->assertSame('0200', bin2hex($bin)); |
| 92 | } |
| 93 | |
| 94 | public function testRecordFieldWithDefault() |
| 95 | { |