1
0
mirror of https://github.com/pmmp/ext-encoding.git synced 2024-11-23 13:36:25 +00:00
ext-encoding/tests/write-byte-array.phpt
Dylan K. Taylor 9a5d74ab2a
Separate read and write offsets
this isn't an ideal solution, but it's the easiest one available and gives time to figure out next steps for the API design.
2024-01-30 14:25:44 +00:00

31 lines
569 B
PHP

--TEST--
Test that ByteBuffer::writeByteArray() works as expected
--FILE--
<?php
use pmmp\encoding\ByteBuffer;
$buffer = new ByteBuffer("");
$buffer->writeByteArray("12345");
var_dump($buffer->getWriteOffset());
var_dump($buffer->toString());
$buffer->writeByteArray("67");
var_dump($buffer->getWriteOffset());
var_dump($buffer->toString());
$buffer->setWriteOffset(2);
$buffer->writeByteArray("890");
var_dump($buffer->getWriteOffset());
var_dump($buffer->toString());
?>
--EXPECT--
int(5)
string(5) "12345"
int(7)
string(7) "1234567"
int(5)
string(7) "1289067"