コード例 #1
0
 public function iteratorHelper(Iterator $iterator, array $items, $startAt, $includeCallsToKey = false)
 {
     $iterator->expects($this->at($startAt))->method('rewind');
     $counter = $startAt + 1;
     foreach ($items as $key => $value) {
         $iterator->expects($this->at($counter++))->method('valid')->will($this->returnValue(true));
         $iterator->expects($this->at($counter++))->method('current')->will($this->returnValue($value));
         if ($includeCallsToKey) {
             $iterator->expects($this->at($counter++))->method('key')->will($this->returnValue($key));
         }
         $iterator->expects($this->at($counter++))->method('next');
     }
     $iterator->expects($this->at($counter++))->method('next')->will($this->returnValue(false));
     return $iterator;
 }
コード例 #2
0
 public function testRewind()
 {
     $this->iterator->expects(self::once())->method('rewind');
     $this->sourceIterator->rewind();
 }