public function vfsStreamFileTestCase::seekRead in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php \org\bovigo\vfs\vfsStreamFileTestCase::seekRead()
test seeking to offset
@test
File
- vendor/
mikey179/ vfsStream/ src/ test/ php/ org/ bovigo/ vfs/ vfsStreamFileTestCase.php, line 139
Class
Namespace
org\bovigo\vfsCode
public function seekRead() {
$this->file
->setContent('foobarbaz');
$this
->assertFalse($this->file
->seek(0, 55));
$this
->assertTrue($this->file
->seek(0, SEEK_SET));
$this
->assertEquals('foobarbaz', $this->file
->readUntilEnd());
$this
->assertEquals(0, $this->file
->getBytesRead());
$this
->assertTrue($this->file
->seek(5, SEEK_SET));
$this
->assertEquals('rbaz', $this->file
->readUntilEnd());
$this
->assertEquals(5, $this->file
->getBytesRead());
$this
->assertTrue($this->file
->seek(0, SEEK_CUR));
$this
->assertEquals('rbaz', $this->file
->readUntilEnd());
$this
->assertEquals(5, $this->file
->getBytesRead(), 5);
$this
->assertTrue($this->file
->seek(2, SEEK_CUR));
$this
->assertEquals('az', $this->file
->readUntilEnd());
$this
->assertEquals(7, $this->file
->getBytesRead());
$this
->assertTrue($this->file
->seek(0, SEEK_END));
$this
->assertEquals('', $this->file
->readUntilEnd());
$this
->assertEquals(9, $this->file
->getBytesRead());
$this
->assertTrue($this->file
->seek(2, SEEK_END));
$this
->assertEquals('', $this->file
->readUntilEnd());
$this
->assertEquals(11, $this->file
->getBytesRead());
}