diff --git a/test/src/StreamHelper.php b/test/src/StreamHelper.php new file mode 100644 index 0000000..cf6e280 --- /dev/null +++ b/test/src/StreamHelper.php @@ -0,0 +1,35 @@ +resource = fopen("php://memory", "w+"); $this->resourceDevNull = fopen("/dev/null", "r"); fwrite($this->resource, $this->content); + StreamHelper::$fail = false; } public function tearDown(): void @@ -106,7 +110,8 @@ class StreamTest extends TestCase public function testTellThrowsRuntimeExceptionWhenUnableToReadStreamPosition() { - $stream = new Stream($this->resourceDevNull); + StreamHelper::$fail = true; + $stream = new Stream($this->resource); $this->expectException(RuntimeException::class); $stream->tell(); } @@ -136,7 +141,8 @@ class StreamTest extends TestCase public function testSeekThrowsRuntimeExceptionWhenUnableToSeek() { - $stream = new Stream($this->resourceDevNull); + StreamHelper::$fail = true; + $stream = new Stream($this->resource); $this->expectException(RuntimeException::class); $stream->seek(10); } @@ -151,7 +157,8 @@ class StreamTest extends TestCase public function testRewindThrowsRuntimeExceptionWhenUnableToRewind() { - $stream = new Stream($this->resourceDevNull); + StreamHelper::$fail = true; + $stream = new Stream($this->resource); $this->expectException(RuntimeException::class); $stream->rewind(); }