Ejemplo n.º 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());
 }
Ejemplo n.º 2
0
 public function testApiSeek_WhenInvalidPositionIsPassed()
 {
     $this->iterator->seek(-1);
     $this->assertSame(0, $this->iterator->key());
 }