Skip to content

Commit

Permalink
fix for Process:isSuccessful()
Browse files Browse the repository at this point in the history
  • Loading branch information
tgabi333 committed Aug 21, 2013
1 parent d58a1e3 commit 0f58865
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public function getExitCodeText()
*/
public function isSuccessful()
{
return 0 == $this->getExitCode();
return 0 === $this->getExitCode();
}

/**
Expand Down
12 changes: 12 additions & 0 deletions Tests/AbstractProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ public function testIsSuccessful()
$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);"');
Expand Down
8 changes: 8 additions & 0 deletions Tests/SigchildDisabledProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public function testIsSuccessful()
parent::testIsSuccessful();
}

/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
public function testIsSuccessfulOnlyAfterTerminated()
{
parent::testIsSuccessfulOnlyAfterTerminated();
}

/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
Expand Down

0 comments on commit 0f58865

Please sign in to comment.