Skip to content

Commit 2e73ec5

Browse files
committed
Check that IteratorIterator works
It does work, but somewhat by accident.
1 parent 3631b8d commit 2e73ec5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/date/tests/DatePeriod_IteratorAggregate.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ for (; $iter->valid(); $iter->next()) {
2929
echo "$i: ", $date->format('Y-m-d'), "\n";
3030
}
3131

32+
echo "\n";
33+
foreach (new IteratorIterator($period) as $i => $date) {
34+
echo "$i: ", $date->format('Y-m-d'), "\n";
35+
}
36+
3237
// Extension that does not overwrite getIterator().
3338
class MyDatePeriod1 extends DatePeriod {
3439
}
@@ -74,6 +79,10 @@ foreach ($period as $i => $notDate) {
7479
1: 2012-07-08
7580
2: 2012-07-15
7681

82+
0: 2012-07-01
83+
1: 2012-07-08
84+
2: 2012-07-15
85+
7786
0: 1
7887
1: 2
7988
2: 3

0 commit comments

Comments
 (0)