Merge branch '2.3' into 2.7

* 2.3:
  [Process] Clean tested process on tear down
This commit is contained in:
Nicolas Grekas 2015-12-31 11:59:19 +01:00
commit bd97e51e0b

View File

@ -24,6 +24,7 @@ use Symfony\Component\Process\Process;
class ProcessTest extends \PHPUnit_Framework_TestCase
{
private static $phpBin;
private static $process;
private static $sigchild;
private static $notEnhancedSigchild = false;
@ -43,6 +44,14 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
}
protected function tearDown()
{
if (self::$process) {
self::$process->stop(0);
self::$process = null;
}
}
public function testThatProcessDoesNotThrowWarningDuringRun()
{
@trigger_error('Test Error', E_USER_NOTICE);
@ -123,9 +132,9 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
$h = new \ReflectionProperty($p, 'process');
$h->setAccessible(true);
$h = $h->getValue($p);
$s = proc_get_status($h);
$s = @proc_get_status($h);
while ($s['running']) {
while (!empty($s['running'])) {
usleep(1000);
$s = proc_get_status($h);
}
@ -1277,7 +1286,11 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
}
}
return $process;
if (self::$process) {
self::$process->stop(0);
}
return self::$process = $process;
}
private function skipIfNotEnhancedSigchild($expectException = true)