From 6bd16b9ff394d42d07d64a5eff43f595035a2e18 Mon Sep 17 00:00:00 2001 From: Eric Poe Date: Wed, 13 Sep 2017 21:34:05 -0500 Subject: [PATCH] Provide test for bug #68004 --- ext/spl/tests/bug68004.phpt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ext/spl/tests/bug68004.phpt diff --git a/ext/spl/tests/bug68004.phpt b/ext/spl/tests/bug68004.phpt new file mode 100644 index 0000000000..aae18d3fdd --- /dev/null +++ b/ext/spl/tests/bug68004.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #68004 (SplTempFileObject and LimitIterator don't come along) +--CREDITS-- +KCPHPUG TestFest 2017 - Eric Poe +--FILE-- +fwrite($content); + +$iterator = new CallbackFilterIterator($tmpCsvFile, function ($row) { + return true; +}); + +echo 'Limit 1: ', iterator_count(new LimitIterator($iterator, 1)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 1)), "\n"; +echo 'Limit 2: ', iterator_count(new LimitIterator($iterator, 2)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 2)), "\n"; +echo 'Limit 3: ', iterator_count(new LimitIterator($iterator, 3)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 3)), "\n"; +?> +--XFAIL-- +Bug #68004 - this will pass when LimitIterator shows the same count for both SplTempFileObject (an outer iterator) and CallbackFilterIterator +--EXPECT-- +Limit 1: 3 3 +Limit 2: 2 2 +Limit 3: 1 1 \ No newline at end of file