/**
  * test reading contents from the file
  *
  * @test
  */
 public function read()
 {
     $this->file->setContent('foobarbaz');
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('foo', $this->file->read(3));
     $this->assertEquals(3, $this->file->getBytesRead());
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('bar', $this->file->read(3));
     $this->assertEquals(6, $this->file->getBytesRead());
     $this->assertFalse($this->file->eof());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals('baz', $this->file->read(3));
     $this->assertEquals(9, $this->file->getBytesRead());
     $this->assertEquals(9, $this->file->size());
     $this->assertTrue($this->file->eof());
     $this->assertEquals('', $this->file->read(3));
 }
Exemple #2
0
 /**
  * checks whether stream is at end of file
  *
  * @return  bool
  */
 public function stream_eof()
 {
     return $this->content->eof();
 }