You are here

public function vfsStreamFileTestCase::seekEmptyFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php \org\bovigo\vfs\vfsStreamFileTestCase::seekEmptyFile()

test seeking to offset

@test

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php, line 117

Class

vfsStreamFileTestCase
Test for org\bovigo\vfs\vfsStreamFile.

Namespace

org\bovigo\vfs

Code

public function seekEmptyFile() {
  $this
    ->assertFalse($this->file
    ->seek(0, 55));
  $this
    ->assertTrue($this->file
    ->seek(0, SEEK_SET));
  $this
    ->assertEquals(0, $this->file
    ->getBytesRead());
  $this
    ->assertTrue($this->file
    ->seek(5, SEEK_SET));
  $this
    ->assertEquals(5, $this->file
    ->getBytesRead());
  $this
    ->assertTrue($this->file
    ->seek(0, SEEK_CUR));
  $this
    ->assertEquals(5, $this->file
    ->getBytesRead());
  $this
    ->assertTrue($this->file
    ->seek(2, SEEK_CUR));
  $this
    ->assertEquals(7, $this->file
    ->getBytesRead());
  $this
    ->assertTrue($this->file
    ->seek(0, SEEK_END));
  $this
    ->assertEquals(0, $this->file
    ->getBytesRead());
  $this
    ->assertTrue($this->file
    ->seek(2, SEEK_END));
  $this
    ->assertEquals(2, $this->file
    ->getBytesRead());
}