Beispiel #1
0
 public function testIteration()
 {
     $result = null;
     for ($i = 0, $this->iterator->rewind(); $this->iterator->valid(); ++$i, $this->iterator->next()) {
         if ($i !== $this->iterator->key()) {
             $this->fail('Got invalid key from iterator.');
         }
         $result .= $this->iterator->current();
     }
     $this->assertSame($this->initialString, $result);
     $this->iterator->prev();
     $this->assertTrue($this->iterator->valid());
     $this->assertSame($this->buffer->length() - 1, $this->iterator->key());
 }
Beispiel #2
0
 public function testApiSeek()
 {
     $this->iterator->seek($this->buffer->length() - 1);
     $this->assertSame($this->buffer->length() - 1, $this->iterator->key());
     $this->assertSame(substr($this->buffer, -1), $this->iterator->current());
 }