mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-23 19:39:10 -04:00
ALPHA 3.0.2a
This commit is contained in:
4
vendor/symfony/process/ExecutableFinder.php
vendored
4
vendor/symfony/process/ExecutableFinder.php
vendored
@@ -71,13 +71,13 @@ class ExecutableFinder
|
||||
}
|
||||
|
||||
$suffixes = array('');
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$pathExt = getenv('PATHEXT');
|
||||
$suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
|
||||
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class PhpExecutableFinder
|
||||
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
|
||||
|
||||
// PHP_BINARY return the current sapi executable
|
||||
if (PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
|
||||
if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
|
||||
return PHP_BINARY.$args;
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ class PhpExecutableFinder
|
||||
}
|
||||
}
|
||||
|
||||
if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
|
||||
if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
|
||||
return $php;
|
||||
}
|
||||
|
||||
$dirs = array(PHP_BINDIR);
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$dirs[] = 'C:\xampp\php\\';
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class PhpExecutableFinder
|
||||
public function findArguments()
|
||||
{
|
||||
$arguments = array();
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$arguments[] = '-qrr';
|
||||
}
|
||||
|
||||
|
||||
2
vendor/symfony/process/PhpProcess.php
vendored
2
vendor/symfony/process/PhpProcess.php
vendored
@@ -38,7 +38,7 @@ class PhpProcess extends Process
|
||||
} else {
|
||||
$php = array_merge(array($php), $executableFinder->findArguments());
|
||||
}
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$file = tempnam(sys_get_temp_dir(), 'dbg');
|
||||
file_put_contents($file, $script);
|
||||
register_shutdown_function('unlink', $file);
|
||||
|
||||
12
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
12
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
@@ -32,9 +32,9 @@ abstract class AbstractPipes implements PipesInterface
|
||||
*/
|
||||
public function __construct($input)
|
||||
{
|
||||
if (is_resource($input) || $input instanceof \Iterator) {
|
||||
if (\is_resource($input) || $input instanceof \Iterator) {
|
||||
$this->input = $input;
|
||||
} elseif (is_string($input)) {
|
||||
} elseif (\is_string($input)) {
|
||||
$this->inputBuffer = $input;
|
||||
} else {
|
||||
$this->inputBuffer = (string) $input;
|
||||
@@ -78,7 +78,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
foreach ($this->pipes as $pipe) {
|
||||
stream_set_blocking($pipe, 0);
|
||||
}
|
||||
if (is_resource($this->input)) {
|
||||
if (\is_resource($this->input)) {
|
||||
stream_set_blocking($this->input, 0);
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ abstract class AbstractPipes implements PipesInterface
|
||||
if ($input instanceof \Iterator) {
|
||||
if (!$input->valid()) {
|
||||
$input = null;
|
||||
} elseif (is_resource($input = $input->current())) {
|
||||
} elseif (\is_resource($input = $input->current())) {
|
||||
stream_set_blocking($input, 0);
|
||||
} elseif (!isset($this->inputBuffer[0])) {
|
||||
if (!is_string($input)) {
|
||||
if (!\is_string($input)) {
|
||||
if (!is_scalar($input)) {
|
||||
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', get_class($this->input), gettype($input)));
|
||||
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', \get_class($this->input), \gettype($input)));
|
||||
}
|
||||
$input = (string) $input;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Process\Pipes;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Symfony\Component\Process\Exception\RuntimeException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
* WindowsPipes implementation uses temporary files as handles.
|
||||
@@ -141,7 +141,7 @@ class WindowsPipes extends AbstractPipes
|
||||
$data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
|
||||
|
||||
if (isset($data[0])) {
|
||||
$this->readBytes[$type] += strlen($data);
|
||||
$this->readBytes[$type] += \strlen($data);
|
||||
$read[$type] = $data;
|
||||
}
|
||||
if ($close) {
|
||||
|
||||
48
vendor/symfony/process/Process.php
vendored
48
vendor/symfony/process/Process.php
vendored
@@ -139,7 +139,7 @@ class Process implements \IteratorAggregate
|
||||
*/
|
||||
public function __construct($commandline, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||
{
|
||||
if (!function_exists('proc_open')) {
|
||||
if (!\function_exists('proc_open')) {
|
||||
throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class Process implements \IteratorAggregate
|
||||
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
|
||||
// @see : https://bugs.php.net/bug.php?id=51800
|
||||
// @see : https://bugs.php.net/bug.php?id=50524
|
||||
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
|
||||
if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
|
||||
$this->cwd = getcwd();
|
||||
}
|
||||
if (null !== $env) {
|
||||
@@ -159,7 +159,7 @@ class Process implements \IteratorAggregate
|
||||
|
||||
$this->setInput($input);
|
||||
$this->setTimeout($timeout);
|
||||
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
|
||||
$this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
|
||||
$this->pty = false;
|
||||
}
|
||||
|
||||
@@ -258,10 +258,10 @@ class Process implements \IteratorAggregate
|
||||
$this->hasCallback = null !== $callback;
|
||||
$descriptors = $this->getDescriptors();
|
||||
|
||||
if (is_array($commandline = $this->commandline)) {
|
||||
if (\is_array($commandline = $this->commandline)) {
|
||||
$commandline = implode(' ', array_map(array($this, 'escapeArgument'), $commandline));
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
// exec is mandatory to deal with sending a signal to the process
|
||||
$commandline = 'exec '.$commandline;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class Process implements \IteratorAggregate
|
||||
|
||||
$options = array('suppress_errors' => true);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$options['bypass_shell'] = true;
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $env);
|
||||
} elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
|
||||
@@ -303,7 +303,7 @@ class Process implements \IteratorAggregate
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $options);
|
||||
|
||||
if (!is_resource($this->process)) {
|
||||
if (!\is_resource($this->process)) {
|
||||
throw new RuntimeException('Unable to launch a new process.');
|
||||
}
|
||||
$this->status = self::STATUS_STARTED;
|
||||
@@ -381,8 +381,8 @@ class Process implements \IteratorAggregate
|
||||
|
||||
do {
|
||||
$this->checkTimeout();
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
} while ($running);
|
||||
|
||||
while ($this->isRunning()) {
|
||||
@@ -883,7 +883,7 @@ class Process implements \IteratorAggregate
|
||||
*/
|
||||
public function getCommandLine()
|
||||
{
|
||||
return is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline;
|
||||
return \is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -972,7 +972,7 @@ class Process implements \IteratorAggregate
|
||||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
|
||||
throw new RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
|
||||
@@ -1078,7 +1078,7 @@ class Process implements \IteratorAggregate
|
||||
{
|
||||
// Process can not handle env values that are arrays
|
||||
$env = array_filter($env, function ($value) {
|
||||
return !is_array($value);
|
||||
return !\is_array($value);
|
||||
});
|
||||
|
||||
$this->env = $env;
|
||||
@@ -1188,7 +1188,7 @@ class Process implements \IteratorAggregate
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return $result = false;
|
||||
}
|
||||
|
||||
@@ -1203,7 +1203,7 @@ class Process implements \IteratorAggregate
|
||||
if ($this->input instanceof \Iterator) {
|
||||
$this->input->rewind();
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
} else {
|
||||
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
@@ -1227,7 +1227,7 @@ class Process implements \IteratorAggregate
|
||||
if ($this->outputDisabled) {
|
||||
return function ($type, $data) use ($callback) {
|
||||
if (null !== $callback) {
|
||||
call_user_func($callback, $type, $data);
|
||||
\call_user_func($callback, $type, $data);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1242,7 +1242,7 @@ class Process implements \IteratorAggregate
|
||||
}
|
||||
|
||||
if (null !== $callback) {
|
||||
call_user_func($callback, $type, $data);
|
||||
\call_user_func($callback, $type, $data);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1261,7 +1261,7 @@ class Process implements \IteratorAggregate
|
||||
$this->processInformation = proc_get_status($this->process);
|
||||
$running = $this->processInformation['running'];
|
||||
|
||||
$this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
|
||||
if ($this->fallbackStatus && $this->isSigchildEnabled()) {
|
||||
$this->processInformation = $this->fallbackStatus + $this->processInformation;
|
||||
@@ -1283,7 +1283,7 @@ class Process implements \IteratorAggregate
|
||||
return self::$sigchild;
|
||||
}
|
||||
|
||||
if (!function_exists('phpinfo')) {
|
||||
if (!\function_exists('phpinfo')) {
|
||||
return self::$sigchild = false;
|
||||
}
|
||||
|
||||
@@ -1358,7 +1358,7 @@ class Process implements \IteratorAggregate
|
||||
private function close(): int
|
||||
{
|
||||
$this->processPipes->close();
|
||||
if (is_resource($this->process)) {
|
||||
if (\is_resource($this->process)) {
|
||||
proc_close($this->process);
|
||||
}
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
@@ -1423,7 +1423,7 @@ class Process implements \IteratorAggregate
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
|
||||
if ($exitCode && $this->isRunning()) {
|
||||
if ($throwException) {
|
||||
@@ -1435,7 +1435,7 @@ class Process implements \IteratorAggregate
|
||||
} else {
|
||||
if (!$this->isSigchildEnabled()) {
|
||||
$ok = @proc_terminate($this->process, $signal);
|
||||
} elseif (function_exists('posix_kill')) {
|
||||
} elseif (\function_exists('posix_kill')) {
|
||||
$ok = @posix_kill($pid, $signal);
|
||||
} elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
|
||||
$ok = false === fgets($pipes[2]);
|
||||
@@ -1532,7 +1532,7 @@ class Process implements \IteratorAggregate
|
||||
*/
|
||||
private function escapeArgument(string $argument): string
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
return "'".str_replace("'", "'\\''", $argument)."'";
|
||||
}
|
||||
if ('' === $argument = (string) $argument) {
|
||||
@@ -1554,13 +1554,13 @@ class Process implements \IteratorAggregate
|
||||
$env = array();
|
||||
|
||||
foreach ($_SERVER as $k => $v) {
|
||||
if (is_string($v) && false !== $v = getenv($k)) {
|
||||
if (\is_string($v) && false !== $v = getenv($k)) {
|
||||
$env[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_ENV as $k => $v) {
|
||||
if (is_string($v)) {
|
||||
if (\is_string($v)) {
|
||||
$env[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
4
vendor/symfony/process/ProcessUtils.php
vendored
4
vendor/symfony/process/ProcessUtils.php
vendored
@@ -42,10 +42,10 @@ class ProcessUtils
|
||||
public static function validateInput($caller, $input)
|
||||
{
|
||||
if (null !== $input) {
|
||||
if (is_resource($input)) {
|
||||
if (\is_resource($input)) {
|
||||
return $input;
|
||||
}
|
||||
if (is_string($input)) {
|
||||
if (\is_string($input)) {
|
||||
return $input;
|
||||
}
|
||||
if (is_scalar($input)) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class ExecutableFinderTest extends TestCase
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->setPath(dirname(PHP_BINARY));
|
||||
$this->setPath(\dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName());
|
||||
@@ -73,7 +73,7 @@ class ExecutableFinderTest extends TestCase
|
||||
|
||||
$this->setPath('');
|
||||
|
||||
$extraDirs = array(dirname(PHP_BINARY));
|
||||
$extraDirs = array(\dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName(), null, $extraDirs);
|
||||
@@ -83,7 +83,7 @@ class ExecutableFinderTest extends TestCase
|
||||
|
||||
public function testFindWithOpenBaseDir()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class ExecutableFinderTest extends TestCase
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->iniSet('open_basedir', dirname(PHP_BINARY).PATH_SEPARATOR.'/');
|
||||
$this->iniSet('open_basedir', \dirname(PHP_BINARY).PATH_SEPARATOR.'/');
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName());
|
||||
@@ -104,7 +104,7 @@ class ExecutableFinderTest extends TestCase
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ class ExecutableFinderTest extends TestCase
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can be only tested on windows');
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class ExecutableFinderTest extends TestCase
|
||||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
@@ -158,6 +158,6 @@ class ExecutableFinderTest extends TestCase
|
||||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class PhpExecutableFinderTest extends TestCase
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
$current = PHP_BINARY;
|
||||
$args = 'phpdbg' === PHP_SAPI ? ' -qrr' : '';
|
||||
$args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : '';
|
||||
|
||||
$this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP');
|
||||
$this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
|
||||
@@ -40,7 +40,7 @@ class PhpExecutableFinderTest extends TestCase
|
||||
{
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
|
||||
} else {
|
||||
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
|
||||
|
||||
@@ -43,6 +43,6 @@ PHP
|
||||
$process->wait();
|
||||
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
|
||||
|
||||
$this->assertSame(PHP_VERSION.PHP_SAPI, $process->getOutput());
|
||||
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,22 +35,22 @@ while ($read || $write) {
|
||||
}
|
||||
|
||||
if (in_array(STDOUT, $w) && strlen($out) > 0) {
|
||||
$written = fwrite(STDOUT, (binary) $out, 32768);
|
||||
$written = fwrite(STDOUT, (string) $out, 32768);
|
||||
if (false === $written) {
|
||||
die(ERR_WRITE_FAILED);
|
||||
}
|
||||
$out = (binary) substr($out, $written);
|
||||
$out = (string) substr($out, $written);
|
||||
}
|
||||
if (null === $read && '' === $out) {
|
||||
$write = array_diff($write, array(STDOUT));
|
||||
}
|
||||
|
||||
if (in_array(STDERR, $w) && strlen($err) > 0) {
|
||||
$written = fwrite(STDERR, (binary) $err, 32768);
|
||||
$written = fwrite(STDERR, (string) $err, 32768);
|
||||
if (false === $written) {
|
||||
die(ERR_WRITE_FAILED);
|
||||
}
|
||||
$err = (binary) substr($err, $written);
|
||||
$err = (string) substr($err, $written);
|
||||
}
|
||||
if (null === $read && '' === $err) {
|
||||
$write = array_diff($write, array(STDERR));
|
||||
|
||||
50
vendor/symfony/process/Tests/ProcessTest.php
vendored
50
vendor/symfony/process/Tests/ProcessTest.php
vendored
@@ -32,7 +32,7 @@ class ProcessTest extends TestCase
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$phpBin = new PhpExecutableFinder();
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === PHP_SAPI ? 'php' : $phpBin->find());
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
|
||||
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL);
|
||||
@@ -67,7 +67,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testThatProcessDoesNotThrowWarningDuringRun()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is transient on Windows');
|
||||
}
|
||||
@trigger_error('Test Error', E_USER_NOTICE);
|
||||
@@ -162,7 +162,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
$o = $p->getOutput();
|
||||
|
||||
$this->assertEquals($expectedOutputSize, strlen($o));
|
||||
$this->assertEquals($expectedOutputSize, \strlen($o));
|
||||
}
|
||||
|
||||
public function testCallbacksAreExecutedWithStart()
|
||||
@@ -204,8 +204,8 @@ class ProcessTest extends TestCase
|
||||
$p->setInput($expected);
|
||||
$p->run();
|
||||
|
||||
$this->assertEquals($expectedLength, strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,8 +226,8 @@ class ProcessTest extends TestCase
|
||||
|
||||
fclose($stream);
|
||||
|
||||
$this->assertEquals($expectedLength, strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
|
||||
}
|
||||
|
||||
public function testLiveStreamAsInput()
|
||||
@@ -307,7 +307,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
@@ -426,7 +426,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testZeroAsOutput()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
|
||||
$p = $this->getProcess('echo | set /p dummyName=0');
|
||||
} else {
|
||||
@@ -439,7 +439,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
|
||||
@@ -450,12 +450,9 @@ class ProcessTest extends TestCase
|
||||
$this->assertGreaterThan(0, $process->getExitCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
public function testTTYCommand()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not have /dev/tty support');
|
||||
}
|
||||
|
||||
@@ -468,12 +465,9 @@ class ProcessTest extends TestCase
|
||||
$this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
public function testTTYCommandExitCode()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
@@ -490,7 +484,7 @@ class ProcessTest extends TestCase
|
||||
*/
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
@@ -567,7 +561,7 @@ class ProcessTest extends TestCase
|
||||
{
|
||||
$process = $this->getProcess('echo foo');
|
||||
$process->run();
|
||||
$this->assertGreaterThan(0, strlen($process->getOutput()));
|
||||
$this->assertGreaterThan(0, \strlen($process->getOutput()));
|
||||
}
|
||||
|
||||
public function testGetExitCodeIsNullOnStart()
|
||||
@@ -654,7 +648,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@@ -665,7 +659,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@@ -676,7 +670,7 @@ class ProcessTest extends TestCase
|
||||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@@ -693,7 +687,7 @@ class ProcessTest extends TestCase
|
||||
*/
|
||||
public function testProcessThrowsExceptionWhenExternallySignaled()
|
||||
{
|
||||
if (!function_exists('posix_kill')) {
|
||||
if (!\function_exists('posix_kill')) {
|
||||
$this->markTestSkipped('Function posix_kill is required.');
|
||||
}
|
||||
|
||||
@@ -997,7 +991,7 @@ class ProcessTest extends TestCase
|
||||
*/
|
||||
public function testWrongSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
@@ -1152,7 +1146,7 @@ class ProcessTest extends TestCase
|
||||
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
|
||||
);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
|
||||
$sizes = array(1, 2, 4, 8);
|
||||
} else {
|
||||
@@ -1430,7 +1424,7 @@ class ProcessTest extends TestCase
|
||||
{
|
||||
$p = new Process(array('/usr/bin/php'));
|
||||
|
||||
$expected = '\\' === DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$this->assertSame($expected, $p->getCommandLine());
|
||||
}
|
||||
|
||||
@@ -1477,7 +1471,7 @@ EOTXT;
|
||||
public function testEnvArgument()
|
||||
{
|
||||
$env = array('FOO' => 'Foo', 'BAR' => 'Bar');
|
||||
$cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$p = new Process($cmd, null, $env);
|
||||
$p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user