public function testOffsetPositionMovesPointerCorrectly() { $file = new File('/file'); $file->setData('data'); $handler = new FileHandler(); $handler->setFile($file); $handler->offsetPosition(2); $this->assertEquals(2, $handler->position()); $handler->offsetPosition(2); $this->assertEquals(4, $handler->position()); }
/** * Sets file pointer to specified position * * @param int $offset * @param int $whence * * @return bool */ public function stream_seek($offset, $whence = SEEK_SET) { switch ($whence) { case SEEK_SET: $this->currently_opened->position($offset); break; case SEEK_CUR: $this->currently_opened->offsetPosition($offset); break; case SEEK_END: $this->currently_opened->seekToEnd(); $this->currently_opened->offsetPosition($offset); } return true; }