Skip to content

Commit

Permalink
Added Maximum Nested test if xdebug is installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Jul 24, 2014
1 parent a8401b3 commit 813cebd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/Ddeboer/DataImport/Tests/Reader/CsvReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 813cebd

Please sign in to comment.