seriously simplify the buffer writer by not accepting a ref to a buffer
[awesomized/ext-ion] / tests / Symbol / Table / Local.phpt
index 25b0cb5e36e2a62ad66bf836cc97472b342faaec..9c6b03ecb869466a6b4171cbfe3e00c601dca13e 100644 (file)
@@ -6,8 +6,7 @@ ion
 TEST
 <?php
 
-$w = new ion\Writer\Buffer\Writer($buf,
-       new ion\Writer\Options(outputBinary: true));
+$w = new ion\Writer\Buffer\Writer(new ion\Writer\Options(outputBinary: true));
 
 $w->writeSymbol("local1");
 $w->writeSymbol("local1");
@@ -16,7 +15,7 @@ $w->writeSymbol("local2");
 
 $w->finish();
 
-foreach (str_split($buf, 8) as $line) {
+foreach (str_split($w->getBuffer(), 8) as $line) {
        printf("%-26s", chunk_split(bin2hex($line), 2, " "));
        foreach (str_split($line) as $byte) {
                echo $byte >= ' ' && $byte <= '~' ? $byte : ".";
@@ -26,7 +25,7 @@ foreach (str_split($buf, 8) as $line) {
 echo "\n";
 
 $u = new ion\Unserializer\PHP(multiSequence: true);
-var_dump($u->unserialize($buf));
+var_dump($u->unserialize($w->getBuffer()));
 
 ?>
 DONE