1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-26 20:04:51 +01:00
byte-stream/test/ResourceOutputStreamTest.php

29 lines
728 B
PHP
Raw Normal View History

<?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);
}
}