本文整理汇总了PHP中SebastianBergmann\Environment\Runtime::getBinary方法的典型用法代码示例。如果您正苦于以下问题:PHP Runtime::getBinary方法的具体用法?PHP Runtime::getBinary怎么用?PHP Runtime::getBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SebastianBergmann\Environment\Runtime
的用法示例。
在下文中一共展示了Runtime::getBinary方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommand
/**
* Returns the command based into the configurations.
*
* @param array $settings
*
* @return string
*/
public function getCommand(array $settings)
{
$command = $this->runtime->getBinary();
$command .= $this->settingsToParameters($settings);
if (true === $this->stderrRedirection) {
$command .= ' 2>&1';
}
return $command;
}
示例2: getCommand
/**
* Returns the command based into the configurations.
*
* @param array $settings
*
* @return string
*/
public function getCommand(array $settings)
{
$command = $this->runtime->getBinary();
$command .= $this->settingsToParameters($settings);
if ('phpdbg' === PHP_SAPI) {
$command .= ' -qrr ' . escapeshellarg(__DIR__ . '/PHP/eval-stdin.php');
}
if (true === $this->stderrRedirection) {
$command .= ' 2>&1';
}
return $command;
}
示例3: startJob
/**
* @param Job $job
* @return bool
*/
public function startJob(Job $job)
{
$this->pool->add($job);
try {
$runtime = new Runtime();
$job->start($runtime->getBinary());
} catch (ForkException $e) {
$this->pool->remove($job);
$job->startTest();
$job->addError($e);
$job->endTest();
return false;
}
$job->startTest();
return true;
}
示例4: runJob
/**
* Runs a single job (PHP code) using a separate PHP process.
*
* @param string $job
* @param array $settings
*
* @return array
*
* @throws PHPUnit_Framework_Exception
*/
public function runJob($job, array $settings = [])
{
$runtime = new Runtime();
$process = proc_open($runtime->getBinary() . $this->settingsToParameters($settings), [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
if (!is_resource($process)) {
throw new PHPUnit_Framework_Exception('Unable to spawn worker process');
}
$this->process($pipes[0], $job);
fclose($pipes[0]);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
proc_close($process);
$this->cleanup();
return ['stdout' => $stdout, 'stderr' => $stderr];
}
示例5: runJob
/**
*
* {@inheritdoc} Reading from STDOUT or STDERR hangs forever on Windows if the output is
* too large.
*
* @see https://bugs.php.net/bug.php?id=51800
*/
public function runJob($job, array $settings = array())
{
$runtime = new Runtime();
if (false === ($stdout_handle = tmpfile())) {
throw new PHPUnit_Framework_Exception('A temporary file could not be created; verify that your TEMP environment variable is writable');
}
$process = proc_open($runtime->getBinary() . $this->settingsToParameters($settings), array(0 => array('pipe', 'r'), 1 => $stdout_handle, 2 => array('pipe', 'w')), $pipes);
if (!is_resource($process)) {
throw new PHPUnit_Framework_Exception('Unable to spawn worker process');
}
$this->process($pipes[0], $job);
fclose($pipes[0]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
proc_close($process);
rewind($stdout_handle);
$stdout = stream_get_contents($stdout_handle);
fclose($stdout_handle);
$this->cleanup();
return array('stdout' => $stdout, 'stderr' => $stderr);
}
示例6: testBinaryCanBeRetrieved
/**
* @covers \SebastianBergmann\Environment\Runtime::getBinary
*
* @uses \SebastianBergmann\Environment\Runtime::isHHVM
*/
public function testBinaryCanBeRetrieved()
{
$this->assertInternalType('string', $this->env->getBinary());
}
示例7: getPhpBinary
private function getPhpBinary()
{
$runtime = new Runtime();
return $runtime->getBinary();
}