public function tearDown() { $this->decorated->close(); $this->body->close(); }
public function testCanDetachStream() { $r = fopen('php://temp', 'w+'); $stream = new Stream($r); $this->assertTrue($stream->isReadable()); $stream->detach(); $this->assertFalse($stream->isReadable()); $stream->close(); }
public function testCloseClearProperties() { $handle = fopen('php://temp', 'r+'); $stream = new Stream($handle); $stream->close(); $this->assertEmpty($stream->getMetadata()); $this->assertFalse($stream->isSeekable()); $this->assertFalse($stream->isReadable()); $this->assertFalse($stream->isWritable()); $this->assertNull($stream->getSize()); }
public function testCanDetachStream() { $r = fopen('php://temp', 'w+'); $stream = new Stream($r); $this->assertTrue($stream->isReadable()); $this->assertSame($r, $stream->detach()); $this->assertNull($stream->detach()); $this->assertFalse($stream->isReadable()); $this->assertSame('', $stream->read(10)); $this->assertFalse($stream->isWritable()); $this->assertFalse($stream->write('foo')); $this->assertFalse($stream->isSeekable()); $this->assertFalse($stream->seek(10)); $this->assertFalse($stream->tell()); $this->assertFalse($stream->eof()); $this->assertNull($stream->getSize()); $this->assertSame('', (string) $stream); $this->assertSame('', $stream->getContents()); $stream->close(); }