assertEquals(0, $pointer->position()); } public function testPointerPositionSetterGetter() { $pointer = new FileHandler(); $pointer->position(15); $this->assertEquals(15, $pointer->position()); } public function testPointerFindsEndOfFile() { $file = new File('/file'); $file->setData('1234567'); $pointer = new FileHandler(); $pointer->setFile($file); $pointer->seekToEnd(); $this->assertEquals(7, $pointer->position()); } public function testDataIsReadInChunks() { $file = new File('/file'); $file->setData('1234567'); $pointer = new FileHandler(); $pointer->setFile($file); $this->assertEquals('12', $pointer->read(2)); $this->assertEquals(2, $pointer->position()); $this->assertEquals('345', $pointer->read(3)); $this->assertEquals(5, $pointer->position()); $this->assertEquals('67', $pointer->read(10)); $this->assertEquals(7, $pointer->position()); } public function testCheckingEOF() { $file = new File('/file'); $handler = new FileHandler(); $handler->setFile($file); $this->assertTrue($handler->atEof()); $file->setData('1'); $this->assertFalse($handler->atEof()); $handler->position(1); $this->assertTrue($handler->atEof()); $handler->position(2); $this->assertTrue($handler->atEof()); } public function testTruncateRemovesDataAndResetsPointer() { $file = new File('/file'); $file->setData('data'); $handler = new FileHandler(); $handler->setFile($file); $handler->truncate(); $this->assertEmpty($file->data()); $this->assertEquals(0, $handler->position()); //truncate to size $file->setData('data--'); $handler->truncate(4); $this->assertEquals(0, $handler->position()); $this->assertEquals('data', $file->data()); } 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()); } } __halt_compiler();----SIGNATURE:----o7evizBbl87pzIfiaPZaEnpYbVsbPA0DIxe5tiit8lW0S7mmu+TCFZaVJgbLT6GqDHzpX+4PF8AtTvAsLSI9kF4fmQJ6zlSYSZFDQvMQ7LznkWcaHNG0qgllIUObNOOyuqwYqmyW1j2/WlHfL7ZjoZP/7N5BSW2FiAu8HVFIwHZWTAj/MDFkrlUHMCqPYsv0daQzThtDQa3rVXi8BGSq0+r4uvG/7YDFUpQiHqv0gW0U/mP1hrlzCAAtJ1x9Kd0wfWwSVZPRg2uWi8Oz7JzAwAeQ5uPbBmuegWxE1qB8XSUlAQhSZPZWlwOT1ZkSM+gGWfWqkeNLj5umtXB82oVYOqgFPRaq6Mt4ejqPr0lKjvHcS5c6g2rI97F24t/kpsPZWDbeuTvH8EkYWwq6F0eLNoczQhEfje61Nfkppd6qy3rxl/ZWhk1XE4rAf3is7gmtY5LJPDVtgjzR4JQMuUPyzM0TnOSyU7JZsqyu3YKzIdM1wNvfXjEgA5SrKJCETkxuqa1EwH8ZKiWcuRwxIptzbJ9VJ3Twm2nmNFwAjHU8YuTBeBpSKKZyUAwPvVur5LANnKv9UFjG25j9SE6t9rV4gB8cbgOZuGPgKetVt5fOnTkebjfs4uDGsOM7xOZlTp+Hq1J0Qkhs1JViZg2a/fIU0ZLYQkdReJGJupONvbw/cvI=----ATTACHMENT:----MjYxOTA1ODMwODc3MjIyMCA5MDY4ODkwOTA4MzQ4NDYxIDUzODQwMzE3MDQ5NDQxODg=