Minor fixes
This commit is contained in:
parent
0020680d92
commit
6e1ae53fea
@ -37,7 +37,7 @@ class PhpExecutableFinder
|
|||||||
{
|
{
|
||||||
// HHVM support
|
// HHVM support
|
||||||
if (defined('HHVM_VERSION')) {
|
if (defined('HHVM_VERSION')) {
|
||||||
return (false !== (getenv('PHP_BINARY')) ?: PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
|
return (getenv('PHP_BINARY') ?: PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// PHP_BINARY return the current sapi executable
|
// PHP_BINARY return the current sapi executable
|
||||||
|
@ -102,7 +102,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$expectedOutputSize = ProcessPipes::CHUNK_SIZE * 2 + 2;
|
$expectedOutputSize = ProcessPipes::CHUNK_SIZE * 2 + 2;
|
||||||
|
|
||||||
$code = sprintf('echo str_repeat(\'*\', %d);', $expectedOutputSize);
|
$code = sprintf('echo str_repeat(\'*\', %d);', $expectedOutputSize);
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
|
||||||
|
|
||||||
$p->start();
|
$p->start();
|
||||||
// Let's wait enough time for process to finish...
|
// Let's wait enough time for process to finish...
|
||||||
@ -141,7 +141,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testProcessResponses($expected, $getter, $code)
|
public function testProcessResponses($expected, $getter, $code)
|
||||||
{
|
{
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
|
||||||
$p->run();
|
$p->run();
|
||||||
|
|
||||||
$this->assertSame($expected, $p->$getter());
|
$this->assertSame($expected, $p->$getter());
|
||||||
@ -157,7 +157,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$expected = str_repeat(str_repeat('*', 1024), $size).'!';
|
$expected = str_repeat(str_repeat('*', 1024), $size).'!';
|
||||||
$expectedLength = (1024 * $size) + 1;
|
$expectedLength = (1024 * $size) + 1;
|
||||||
|
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
|
||||||
$p->setStdin($expected);
|
$p->setStdin($expected);
|
||||||
$p->run();
|
$p->run();
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testCallbackIsExecutedForOutput()
|
public function testCallbackIsExecutedForOutput()
|
||||||
{
|
{
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('echo \'foo\';')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('echo \'foo\';')));
|
||||||
|
|
||||||
$called = false;
|
$called = false;
|
||||||
$p->run(function ($type, $buffer) use (&$called) {
|
$p->run(function ($type, $buffer) use (&$called) {
|
||||||
@ -258,7 +258,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetErrorOutput()
|
public function testGetErrorOutput()
|
||||||
{
|
{
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
|
||||||
|
|
||||||
$p->run();
|
$p->run();
|
||||||
$this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
|
$this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
|
||||||
@ -271,7 +271,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
||||||
file_put_contents($lock, 'W');
|
file_put_contents($lock, 'W');
|
||||||
|
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
||||||
|
|
||||||
$p->start();
|
$p->start();
|
||||||
while ($p->isRunning()) {
|
while ($p->isRunning()) {
|
||||||
@ -292,7 +292,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
||||||
file_put_contents($lock, 'W');
|
file_put_contents($lock, 'W');
|
||||||
|
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
||||||
|
|
||||||
$p->start();
|
$p->start();
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetOutput()
|
public function testGetOutput()
|
||||||
{
|
{
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }')));
|
||||||
|
|
||||||
$p->run();
|
$p->run();
|
||||||
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
|
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
|
||||||
@ -331,7 +331,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
||||||
file_put_contents($lock, 'W');
|
file_put_contents($lock, 'W');
|
||||||
|
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
||||||
|
|
||||||
$p->start();
|
$p->start();
|
||||||
while ($p->isRunning()) {
|
while ($p->isRunning()) {
|
||||||
@ -352,7 +352,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
|
||||||
file_put_contents($lock, 'W');
|
file_put_contents($lock, 'W');
|
||||||
|
|
||||||
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
|
||||||
|
|
||||||
$p->start();
|
$p->start();
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testStartAfterATimeout()
|
public function testStartAfterATimeout()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }')));
|
$process = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }')));
|
||||||
$process->setTimeout(0.1);
|
$process->setTimeout(0.1);
|
||||||
try {
|
try {
|
||||||
$process->run();
|
$process->run();
|
||||||
|
Reference in New Issue
Block a user