Add unit test demonstrating bad exit code getter for a failing process

This commit is contained in:
Romain Neutron 2012-08-30 12:55:38 +02:00
parent 2982e6e678
commit 3bfb9762d7
1 changed files with 13 additions and 0 deletions

View File

@ -89,6 +89,19 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($called, 'The callback should be executed with the output');
}
public function testExitCodeCommandFailed()
{
if (strpos(PHP_OS, "WIN") === 0) {
$this->markTestSkipped('Windows does not support POSIX exit code');
}
// such command run in bash return an exitcode 127
$process = new Process('nonexistingcommandIhopeneversomeonewouldnameacommandlikethis');
$process->run();
$this->assertGreaterThan(0, $process->getExitCode());
}
public function testExitCodeText()
{
$process = new Process('');