diff --git a/tests/Ddeboer/DataImport/Tests/Reader/CsvReaderTest.php b/tests/Ddeboer/DataImport/Tests/Reader/CsvReaderTest.php index 5196d587..42413464 100644 --- a/tests/Ddeboer/DataImport/Tests/Reader/CsvReaderTest.php +++ b/tests/Ddeboer/DataImport/Tests/Reader/CsvReaderTest.php @@ -241,6 +241,37 @@ public function testDuplicateHeadersMerge() $this->assertEquals($expected, $current); } + public function testMaximumNesting() + { + if (!function_exists('xdebug_is_enabled')) { + $this->markTestSkipped('xDebug is not installed'); + } + + $xdebug_start = !xdebug_is_enabled(); + if ($xdebug_start) { + xdebug_enable(); + } + + ini_set('xdebug.max_nesting_level', 200); + + $file = new \SplTempFileObject(); + for($i = 0; $i < 500; $i++) { + $file->fwrite("1,2,3\n"); + } + + $reader = new CsvReader($file); + $reader->rewind(); + $reader->setStrict(true); + $reader->setColumnHeaders(array('one','two')); + + $current = $reader->current(); + $this->assertEquals(null, $current); + + if ($xdebug_start) { + xdebug_disable(); + } + } + protected function getReader($filename) { $file = new \SplFileObject(__DIR__.'/../Fixtures/'.$filename);