public function get_contents()
 {
     $data = 'Test';
     $f = new Stream();
     $f->open(STREAM_MODE_WRITE);
     $f->write($data);
     $f->close();
     $this->assertEquals($data, FileUtil::getContents($f));
 }
 /**
  * Returns 
  *
  * @return  io.Stream
  */
 protected function archiveBytesAsStream($version = -1)
 {
     static $bytes = array(1 => "CCA", 2 => "CCA");
     $s = new Stream();
     $s->open(STREAM_WRITE);
     $s->write($bytes[$version < 0 ? $this->version() : $version]);
     $s->write(str_repeat("", 248));
     // Reserved bytes
     $s->close();
     return $s;
 }
Beispiel #3
0
 public function positionAfterReOpen()
 {
     $s = new Stream();
     $s->open(STREAM_MODE_WRITE);
     $s->write('GIF89a');
     $s->close();
     $s->open(STREAM_MODE_READ);
     $this->assertEquals(0, $s->tell());
     $this->assertEquals('GIF89a', $s->read());
     $s->close();
 }