Skip to content

Commit 26b0e9c

Browse files
Tweaked parser tests
1 parent 92e9783 commit 26b0e9c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/Dotenv/ParserTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public function testQuotesParse()
1515
$this->assertSame(['FOO', "BAR \n"], Parser::parse("FOO=\"BAR \n\""));
1616
}
1717

18+
public function testWhitespaceParse()
19+
{
20+
$this->assertSame(['FOO', "\n"], Parser::parse("FOO=\"\n\""));
21+
}
22+
1823
public function testExportParse()
1924
{
2025
$this->assertSame(['FOO', 'bar baz'], Parser::parse('export FOO="bar baz"'));
@@ -49,15 +54,16 @@ public function testParseInvalidName()
4954

5055
/**
5156
* @expectedException \Dotenv\Exception\InvalidFileException
52-
* @expectedExceptionMessageRegExp /Failed to parse dotenv file due to a quote parsing error.+/
57+
* @expectedExceptionMessage Failed to parse dotenv file due to a quote parsing error (PREG_BACKTRACK_LIMIT_ERROR). Failed at ["iiiiviiiixiiiiviiii\n"].
5358
*/
5459
public function testParserFailsWithException()
5560
{
56-
$default = 1000000;
5761
$limit = (int) ini_get('pcre.backtrack_limit');
58-
if($limit != $default) {
59-
$this->markTestIncomplete();
62+
63+
if ($limit > 1000000) {
64+
$this->markTestSkipped('System pcre.backtrack_limit too large.');
6065
}
66+
6167
Parser::parse('FOO_BAD="iiiiviiiixiiiiviiii\\n"');
6268
}
6369
}

0 commit comments

Comments
 (0)