public function testCloseAndException() { $stream = new Stream('php://memory', 'w+'); $stream->close(); $stream->close(); $this->assertFalse($stream->isWritable()); $this->assertFalse($stream->isReadable()); $this->assertFalse($stream->isSeekable()); $this->assertSame('', $stream->__toString()); $this->assertNull($stream->getSize()); $this->assertTrue($stream->eof()); try { $stream->write('...?'); $this->fail(); } catch (RuntimeException $e) { $this->assertEquals('No resource available.', $e->getMessage()); } }