Skip to content

Commit e7801d9

Browse files
committed
Work around testing for platform-specific EOLs on Windows
1 parent ccd09b4 commit e7801d9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/FunctionalExampleTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public function testQueryExampleReturnsDefaultValue()
1010
{
1111
$output = $this->execExample(escapeshellarg(PHP_BINARY) . ' query.php');
1212

13-
$this->assertEquals('value' . PHP_EOL . '42' . PHP_EOL, $output);
13+
$this->assertEquals('value' . "\n" . '42' . "\n", $output);
1414
}
1515

1616
public function testQueryExampleReturnsCalculatedValueFromPlaceholderVariables()
1717
{
1818
$output = $this->execExample(escapeshellarg(PHP_BINARY) . ' query.php "SELECT ?+? AS result" 1 2');
1919

20-
$this->assertEquals('result' . PHP_EOL . '3' . PHP_EOL, $output);
20+
$this->assertEquals('result' . "\n" . '3' . "\n", $output);
2121
}
2222

2323
public function testQueryExampleExecutedWithCgiReturnsDefaultValueAfterContentTypeHeader()
@@ -28,14 +28,14 @@ public function testQueryExampleExecutedWithCgiReturnsDefaultValueAfterContentTy
2828

2929
$output = $this->execExample('php-cgi query.php');
3030

31-
$this->assertStringEndsWith("\r\n\r\n" . 'value' . PHP_EOL . '42' . PHP_EOL, $output);
31+
$this->assertStringEndsWith("\n\n" . 'value' . "\n" . '42' . "\n", $output);
3232
}
3333

3434
public function testQueryExampleWithOpenBasedirRestrictedReturnsDefaultValue()
3535
{
3636
$output = $this->execExample(escapeshellarg(PHP_BINARY) . ' -dopen_basedir=' . escapeshellarg(dirname(__DIR__)) . ' query.php');
3737

38-
$this->assertEquals('value' . PHP_EOL . '42' . PHP_EOL, $output);
38+
$this->assertEquals('value' . "\n" . '42' . "\n", $output);
3939
}
4040

4141
public function testQueryExampleWithOpenBasedirRestrictedAndAdditionalFileDescriptorReturnsDefaultValue()
@@ -46,7 +46,7 @@ public function testQueryExampleWithOpenBasedirRestrictedAndAdditionalFileDescri
4646

4747
$output = $this->execExample(escapeshellarg(PHP_BINARY) . ' -dopen_basedir=' . escapeshellarg(dirname(__DIR__)) . ' query.php 3</dev/null');
4848

49-
$this->assertEquals('value' . PHP_EOL . '42' . PHP_EOL, $output);
49+
$this->assertEquals('value' . "\n" . '42' . "\n", $output);
5050
}
5151

5252
public function testQueryExampleExecutedWithCgiAndOpenBasedirRestrictedRunsDefaultPhpAndReturnsDefaultValueAfterContentTypeHeader()
@@ -57,7 +57,7 @@ public function testQueryExampleExecutedWithCgiAndOpenBasedirRestrictedRunsDefau
5757

5858
$output = $this->execExample('php-cgi -dopen_basedir=' . escapeshellarg(dirname(__DIR__)) . ' query.php');
5959

60-
$this->assertStringEndsWith("\r\n\r\n" . 'value' . PHP_EOL . '42' . PHP_EOL, $output);
60+
$this->assertStringEndsWith("\n\n" . 'value' . "\n" . '42' . "\n", $output);
6161
}
6262

6363
private function canExecute($command)
@@ -73,6 +73,6 @@ private function execExample($command)
7373
{
7474
chdir(__DIR__ . '/../examples/');
7575

76-
return shell_exec($command);
76+
return str_replace("\r\n", "\n", shell_exec($command));
7777
}
7878
}

0 commit comments

Comments
 (0)