1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-30 04:19:23 +01:00

Add test case for #47

This commit is contained in:
Niklas Keller 2018-12-25 12:59:12 +01:00
parent 37b9ab16bb
commit 23d720fbb1
3 changed files with 25 additions and 3 deletions

@ -1 +1 @@
Subproject commit bd32eb0458ad2f1f66b322a816e0cb8341e3f806
Subproject commit cb9279c84cea4128da664ed34d4a7d4d3ebc9279

0
middle Normal file
View File

View File

@ -71,7 +71,8 @@ class ResourceStreamTest extends TestCase
Loop::run(function () {
try { /* prevent crashes with phpdbg due to SIGPIPE not being handled... */
Loop::onSignal(\defined("SIGPIPE") ? SIGPIPE : 13, function () {});
Loop::onSignal(\defined("SIGPIPE") ? SIGPIPE : 13, function () {
});
} catch (Loop\UnsupportedFeatureException $e) {
}
@ -94,7 +95,8 @@ class ResourceStreamTest extends TestCase
Loop::run(function () {
try { /* prevent crashes with phpdbg due to SIGPIPE not being handled... */
Loop::onSignal(\defined("SIGPIPE") ? SIGPIPE : 13, function () {});
Loop::onSignal(\defined("SIGPIPE") ? SIGPIPE : 13, function () {
});
} catch (Loop\UnsupportedFeatureException $e) {
}
@ -249,4 +251,24 @@ class ResourceStreamTest extends TestCase
$this->assertSame($message, $received);
});
}
public function testIssue47()
{
Loop::run(function () {
$middle = \tempnam(\sys_get_temp_dir(), 'byte-stream-middle-');
\Amp\ByteStream\pipe(
new ResourceInputStream(fopen(__FILE__, 'rb')),
new ResourceOutputStream(fopen($middle, 'wb'))
);
$middleReadStream = new ResourceInputStream(fopen($middle, 'rb'));
while (null !== $chunk = yield $middleReadStream->read()) {
unset($chunk);
}
$this->assertTrue(true);
});
}
}