Skip to content

Commit

Permalink
Add failing test for gzip stream modes
Browse files Browse the repository at this point in the history
See #115
  • Loading branch information
sagikazarmark committed Apr 1, 2019
1 parent dcc698d commit 7278a55
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/StreamTest.php
Expand Up @@ -231,6 +231,32 @@ public function testStreamReadingFreadError()
self::$isFReadError = false;
$stream->close();
}

/**
* @dataProvider gzipModeProvider
*
* @param string $mode
* @param bool $readable
* @param bool $writable
*/
public function testGzipStreamModes($mode, $readable, $writable)
{
$r = gzopen('php://temp', $mode);
$stream = new Stream($r);

$this->assertSame($readable, $stream->isReadable());
$this->assertSame($writable, $stream->isWritable());

$stream->close();
}

public function gzipModeProvider()
{
return [
['mode' => 'rb9', 'readable' => true, 'writable' => false],
['mode' => 'wb2', 'readable' => false, 'writable' => true],
];
}
}

namespace GuzzleHttp\Psr7;
Expand Down

0 comments on commit 7278a55

Please sign in to comment.