We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0998599 commit aea6ee0Copy full SHA for aea6ee0
tests/CachingGeneratorTest.php
@@ -46,6 +46,25 @@ public function testWorksTwice()
46
$this->assertEquals(range(0, 2), $results);
47
}
48
49
+ public function testPicksUpWhereItLeftOff()
50
+ {
51
+ $generator = function () {
52
+ foreach (range(0, 2) as $value) {
53
+ yield $value;
54
+ }
55
+ };
56
+ $cachingGenerator = new CachingGenerator($generator());
57
+
58
+ foreach ($cachingGenerator as $value) {
59
+ if ($value === 1) {
60
+ break;
61
62
63
64
+ $results = iterator_to_array($cachingGenerator);
65
+ $this->assertEquals(range(0, 2), $results);
66
67
68
public function testExposesInnerGenerator()
69
{
70
$generator = function () {
0 commit comments