fix for Process:isSuccessful()
This commit is contained in:
parent
98e1795915
commit
262879d8b5
|
@ -489,7 +489,7 @@ class Process
|
|||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
return 0 == $this->getExitCode();
|
||||
return 0 === $this->getExitCode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -277,6 +277,18 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertTrue($process->isSuccessful());
|
||||
}
|
||||
|
||||
public function testIsSuccessfulOnlyAfterTerminated()
|
||||
{
|
||||
$process = $this->getProcess('sleep 1');
|
||||
$process->start();
|
||||
while ($process->isRunning()) {
|
||||
$this->assertFalse($process->isSuccessful());
|
||||
usleep(300000);
|
||||
}
|
||||
|
||||
$this->assertTrue($process->isSuccessful());
|
||||
}
|
||||
|
||||
public function testIsNotSuccessful()
|
||||
{
|
||||
$process = $this->getProcess('php -r "sleep(4);"');
|
||||
|
|
|
@ -80,6 +80,14 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
|
|||
parent::testIsSuccessful();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||
*/
|
||||
public function testIsSuccessfulOnlyAfterTerminated()
|
||||
{
|
||||
parent::testIsSuccessfulOnlyAfterTerminated();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||
*/
|
||||
|
|
Reference in New Issue