1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-30 04:19:23 +01:00
byte-stream/test/ResourceInputStreamTest.php
2017-05-16 23:27:48 +02:00

29 lines
722 B
PHP

<?php
namespace Amp\ByteStream\Test;
use Amp\ByteStream\ResourceInputStream;
use PHPUnit\Framework\TestCase;
class ResourceInputStreamTest extends TestCase {
public function testGetResource() {
$stream = new ResourceInputStream(\STDIN);
$this->assertSame(\STDIN, $stream->getResource());
}
public function testNonStream() {
$this->expectException(\Error::class);
$this->expectExceptionMessage("Expected a valid stream");
new ResourceInputStream(42);
}
public function testNotReadable() {
$this->expectException(\Error::class);
$this->expectExceptionMessage("Expected a readable stream");
new ResourceInputStream(\STDOUT);
}
}