Skip to content

Instantly share code, notes, and snippets.

@arnolanglade
Created March 15, 2016 09:10
Show Gist options
  • Save arnolanglade/0d5c1c0c2a8064db23be to your computer and use it in GitHub Desktop.
Save arnolanglade/0d5c1c0c2a8064db23be to your computer and use it in GitHub Desktop.
$collection->getIterator()->willReturn($iterator);
$iterator->rewind()->willReturn(null);
$valueCount = 1;
$iterator->valid()->will(
function () use (&$valueCount) {
return $valueCount-- > 0;
}
);
$iterator->current()->willReturn($value);
$iterator->next()->willReturn(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment