8000 Add unit test demonstrating bad exit code getter for a failing process · symfony/symfony@3bfb976 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bfb976

Browse files
committed
Add unit test demonstrating bad exit code getter for a failing process
1 parent 2982e6e commit 3bfb976

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ public function testCallbackIsExecutedForOutput()
8989
$this->assertTrue($called, 'The callback should be executed with the output');
9090
}
9191

92+
public function testExitCodeCommandFailed()
93+
{
94+
if (strpos(PHP_OS, "WIN") === 0) {
95+
$this->markTestSkipped('Windows does not support POSIX exit code');
96+
}
97+
98+
// such command run in bash return an exitcode 127
99+
$process = new Process('nonexistingcommandIhopeneversomeonewouldnameacommandlikethis');
100+
$process->run();
101+
102+
$this->assertGreaterThan(0, $process->getExitCode());
103+
}
104+
92105
public function testExitCodeText()
93106
{
94107
$process = new Process('');

0 commit comments

Comments
 (0)
0