mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 16:44:07 +02:00
handle seeks in countwrapper
This commit is contained in:
parent
89a8191632
commit
a0b84d362c
2 changed files with 29 additions and 0 deletions
|
|
@ -46,4 +46,22 @@ class CountWrapperTest extends WrapperTest {
|
|||
fclose($wrapped);
|
||||
$this->assertSame(6, $count);
|
||||
}
|
||||
|
||||
public function testReadCountSeek() {
|
||||
$count = 0;
|
||||
|
||||
$source = fopen('php://temp', 'r+');
|
||||
fwrite($source, 'foobar');
|
||||
rewind($source);
|
||||
|
||||
$wrapped = CountWrapper::wrap($source, function ($readCount) use (&$count) {
|
||||
$count = $readCount;
|
||||
});
|
||||
|
||||
stream_get_contents($wrapped);
|
||||
fseek($wrapped, 3);
|
||||
stream_get_contents($wrapped);
|
||||
fclose($wrapped);
|
||||
$this->assertSame(6, $count);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue