Merge branch '2.3' into 2.7
* 2.3: [Process] Clean tested process on tear down
This commit is contained in:
commit
bd97e51e0b
@ -24,6 +24,7 @@ use Symfony\Component\Process\Process;
|
|||||||
class ProcessTest extends \PHPUnit_Framework_TestCase
|
class ProcessTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private static $phpBin;
|
private static $phpBin;
|
||||||
|
private static $process;
|
||||||
private static $sigchild;
|
private static $sigchild;
|
||||||
private static $notEnhancedSigchild = false;
|
private static $notEnhancedSigchild = false;
|
||||||
|
|
||||||
@ -43,6 +44,14 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
|
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()
|
public function testThatProcessDoesNotThrowWarningDuringRun()
|
||||||
{
|
{
|
||||||
@trigger_error('Test Error', E_USER_NOTICE);
|
@trigger_error('Test Error', E_USER_NOTICE);
|
||||||
@ -123,9 +132,9 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$h = new \ReflectionProperty($p, 'process');
|
$h = new \ReflectionProperty($p, 'process');
|
||||||
$h->setAccessible(true);
|
$h->setAccessible(true);
|
||||||
$h = $h->getValue($p);
|
$h = $h->getValue($p);
|
||||||
$s = proc_get_status($h);
|
$s = @proc_get_status($h);
|
||||||
|
|
||||||
while ($s['running']) {
|
while (!empty($s['running'])) {
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
$s = proc_get_status($h);
|
$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)
|
private function skipIfNotEnhancedSigchild($expectException = true)
|
||||||
|
Reference in New Issue
Block a user