mirror of
https://github.com/pmmp/ext-encoding.git
synced 2025-09-24 01:33:19 +00:00
closes #13 This prevents accidentally writing when reading is intended, and vice versa. It also allows specialising the APIs and constructors.
23 lines
445 B
PHP
23 lines
445 B
PHP
--TEST--
|
|
Test that ByteBufferWriter::trim() works correctly
|
|
--FILE--
|
|
<?php
|
|
|
|
use pmmp\encoding\ByteBufferWriter;
|
|
|
|
$buffer = new ByteBufferWriter("");
|
|
$buffer->reserve(100);
|
|
$buffer->writeByteArray("aaaaa");
|
|
var_dump($buffer->getReservedLength());
|
|
$buffer->trim();
|
|
var_dump($buffer->getReservedLength());
|
|
|
|
$buffer = new ByteBufferWriter("aaaaaaaaaa");
|
|
$buffer->trim();
|
|
var_dump($buffer->getReservedLength());
|
|
?>
|
|
--EXPECT--
|
|
int(100)
|
|
int(5)
|
|
int(10)
|