Inheritance: implements SeekableIterato\SeekableIterator
コード例 #1
0
 public function testApiRemove_ThrowsException_OnInvalidIterator()
 {
     $this->setExpectedException(OutOfBoundsException::class);
     for ($this->iterator->rewind(); $this->iterator->valid(); $this->iterator->next()) {
     }
     $this->iterator->remove();
 }
コード例 #2
0
ファイル: BufferTest.php プロジェクト: kraken-php/framework
 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());
 }