Exemplo n.º 1
0
 public function tearDown()
 {
     $this->decorated->close();
     $this->body->close();
 }
Exemplo n.º 2
0
 public function testCanDetachStream()
 {
     $r = fopen('php://temp', 'w+');
     $stream = new Stream($r);
     $this->assertTrue($stream->isReadable());
     $stream->detach();
     $this->assertFalse($stream->isReadable());
     $stream->close();
 }
Exemplo n.º 3
0
 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());
 }
Exemplo n.º 4
0
 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();
 }