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

29 lines
728 B
PHP

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