You are here

public function vfsStreamFileTestCase::read in Zircon Profile 8.0

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

test reading contents from the file

@test

File

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

Class

vfsStreamFileTestCase
Test for org\bovigo\vfs\vfsStreamFile.

Namespace

org\bovigo\vfs

Code

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));
}