You are here

public function vfsStreamWrapperFileTestCase::usingFilePointer in Zircon Profile 8

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

using a file pointer should work without any problems

@test

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTestCase.php, line 119

Class

vfsStreamWrapperFileTestCase
Test for org\bovigo\vfs\vfsStreamWrapper.

Namespace

org\bovigo\vfs

Code

public function usingFilePointer() {
  $fp = fopen($this->baz1URL, 'r');
  $this
    ->assertEquals(0, ftell($fp));
  $this
    ->assertFalse(feof($fp));
  $this
    ->assertEquals(0, fseek($fp, 2));
  $this
    ->assertEquals(2, ftell($fp));
  $this
    ->assertEquals(0, fseek($fp, 1, SEEK_CUR));
  $this
    ->assertEquals(3, ftell($fp));
  $this
    ->assertEquals(0, fseek($fp, 1, SEEK_END));
  $this
    ->assertEquals(6, ftell($fp));
  $this
    ->assertTrue(feof($fp));
  $this
    ->assertEquals(0, fseek($fp, 2));
  $this
    ->assertFalse(feof($fp));
  $this
    ->assertEquals(2, ftell($fp));
  $this
    ->assertEquals('z', fread($fp, 1));
  $this
    ->assertEquals(3, ftell($fp));
  $this
    ->assertEquals(' 1', fread($fp, 8092));
  $this
    ->assertEquals(5, ftell($fp));
  $this
    ->assertTrue(fclose($fp));
}