Skip to content

Commit ce9850f

Browse files
[Process] Fix test case
1 parent 1a44dc3 commit ce9850f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Tests/ErrorProcessInitiator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
use Symfony\Component\Process\Exception\ProcessTimedOutException;
1515
use Symfony\Component\Process\Process;
1616

17-
require \dirname(__DIR__).'/vendor/autoload.php';
17+
require is_file(\dirname(__DIR__).'/vendor/autoload.php') ? \dirname(__DIR__).'/vendor/autoload.php' : \dirname(__DIR__, 5).'/vendor/autoload.php';
1818

1919
['e' => $php] = getopt('e:') + ['e' => 'php'];
2020

2121
try {
22-
$process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\"");
22+
$process = new Process([$php, '-r', "echo 'ready'; trigger_error('error', E_USER_ERROR);"]);
2323
$process->start();
2424
$process->setTimeout(0.5);
2525
while (!str_contains($process->getOutput(), 'ready')) {

Tests/ProcessTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,10 @@ public function testWaitStoppedDeadProcess()
15231523
$process->setTimeout(2);
15241524
$process->wait();
15251525
$this->assertFalse($process->isRunning());
1526+
1527+
if ('\\' !== \DIRECTORY_SEPARATOR) {
1528+
$this->assertSame(0, $process->getExitCode());
1529+
}
15261530
}
15271531

15281532
public function testEnvCaseInsensitiveOnWindows()

0 commit comments

Comments
 (0)