Ejemplo n.º 1
0
 public function testAllowsBoundedSeek()
 {
     $this->body->seek(100);
     $this->assertEquals(13, $this->decorated->tell());
     $this->body->seek(0);
     $this->assertEquals(0, $this->body->tell());
     $this->assertEquals(3, $this->decorated->tell());
     $this->assertEquals(false, $this->body->seek(1000, SEEK_END));
 }
Ejemplo n.º 2
0
 public function testCanDetachStream()
 {
     $r = fopen('php://temp', 'w+');
     $stream = new puzzle_stream_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();
 }