Skip to content

Commit b8f2c74

Browse files
authored
test: Cover the new escaped mutations (#347)
1 parent 8b0a4d9 commit b8f2c74

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

infection.json5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
"ignoreSourceCodeByRegex": [
7676
".*ResettableContainerInterface.*"
7777
]
78+
},
79+
"TrueValue": {
80+
"ignoreSourceCodeByRegex": [
81+
// This flag is for performance optimisation.
82+
".*sourceExhausted = true.*",
83+
]
7884
}
7985
}
8086
}

tests/ChunkedItemsIteratorTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ public static function valuesProvider(): iterable
172172
],
173173
];
174174

175+
yield 'items with keys' => [
176+
['key0' => 'item0', 'key1' => 'item1', 'key3' => 'item3', 'key4' => 'item4'],
177+
2,
178+
['item0', 'item1', 'item3', 'item4'],
179+
4,
180+
[
181+
['item0', 'item1'],
182+
['item3', 'item4'],
183+
],
184+
];
185+
175186
yield 'less items than batch size' => [
176187
['item0', 'item1', 'item3'],
177188
4,

tests/LazyRewindableIteratorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,17 @@ public function test_it_loads_values_lazily_and_do_not_loads_them_multiple_times
181181
self::assertSame(1, $breakpoint2);
182182
self::assertSame(1, $breakpoint3);
183183
}
184+
185+
public function test_iterator_api_can_be_directly_consumed(): void
186+
{
187+
$input = (static function () {
188+
yield 'first';
189+
yield 'second';
190+
yield 'third';
191+
})();
192+
193+
$iterator = LazyRewindableIterator::create($input);
194+
195+
self::assertSame('first', $iterator->current());
196+
}
184197
}

0 commit comments

Comments
 (0)