update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
46
pfosten/vendor/symfony/process/Tests/ExecutableFinderTest.php
vendored
Executable file → Normal file
46
pfosten/vendor/symfony/process/Tests/ExecutableFinderTest.php
vendored
Executable file → Normal file
|
|
@ -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).(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
$this->iniSet('open_basedir', \dirname(PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName());
|
||||
|
|
@ -104,12 +104,12 @@ 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');
|
||||
}
|
||||
|
||||
$this->setPath('');
|
||||
$this->iniSet('open_basedir', PHP_BINARY.(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
$this->iniSet('open_basedir', PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName(), false);
|
||||
|
|
@ -117,9 +117,39 @@ class ExecutableFinderTest extends TestCase
|
|||
$this->assertSamePath(PHP_BINARY, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.4
|
||||
*/
|
||||
public function testFindBatchExecutableOnWindows()
|
||||
{
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can be only tested on windows');
|
||||
}
|
||||
|
||||
$target = tempnam(sys_get_temp_dir(), 'example-windows-executable');
|
||||
|
||||
touch($target);
|
||||
touch($target.'.BAT');
|
||||
|
||||
$this->assertFalse(is_executable($target));
|
||||
|
||||
$this->setPath(sys_get_temp_dir());
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find(basename($target), false);
|
||||
|
||||
unlink($target);
|
||||
unlink($target.'.BAT');
|
||||
|
||||
$this->assertSamePath($target.'.BAT', $result);
|
||||
}
|
||||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
|
|
@ -128,6 +158,6 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Tests/NonStopableProcess.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Tests/NonStopableProcess.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/PhpExecutableFinderTest.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/PhpExecutableFinderTest.php
vendored
Executable file → Normal file
|
|
@ -24,14 +24,14 @@ class PhpExecutableFinderTest extends TestCase
|
|||
*/
|
||||
public function testFind()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('Should not be executed in HHVM context.');
|
||||
}
|
||||
|
||||
$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');
|
||||
|
|
@ -42,7 +42,7 @@ class PhpExecutableFinderTest extends TestCase
|
|||
*/
|
||||
public function testFindWithHHVM()
|
||||
{
|
||||
if (!defined('HHVM_VERSION')) {
|
||||
if (!\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('Should be executed in HHVM context.');
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ class PhpExecutableFinderTest extends TestCase
|
|||
{
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments');
|
||||
} elseif ('phpdbg' === PHP_SAPI) {
|
||||
} elseif ('phpdbg' === \PHP_SAPI) {
|
||||
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
|
||||
} else {
|
||||
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/process/Tests/PhpProcessTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/process/Tests/PhpProcessTest.php
vendored
Executable file → Normal file
|
|
@ -43,6 +43,6 @@ PHP
|
|||
$process->wait();
|
||||
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
|
||||
|
||||
$this->assertSame(phpversion().PHP_SAPI, $process->getOutput());
|
||||
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php
vendored
Executable file → Normal file
|
|
@ -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));
|
||||
|
|
|
|||
35
pfosten/vendor/symfony/process/Tests/ProcessBuilderTest.php
vendored
Executable file → Normal file
35
pfosten/vendor/symfony/process/Tests/ProcessBuilderTest.php
vendored
Executable file → Normal file
|
|
@ -14,11 +14,11 @@ namespace Symfony\Component\Process\Tests;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class ProcessBuilderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testInheritEnvironmentVars()
|
||||
{
|
||||
$proc = ProcessBuilder::create()
|
||||
|
|
@ -90,14 +90,14 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix('/usr/bin/php');
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" -v', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine());
|
||||
}
|
||||
|
||||
$proc = $pb->setArguments(array('-i'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" -i', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine());
|
||||
|
|
@ -110,14 +110,14 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix(array('/usr/bin/php', 'composer.phar'));
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" composer.phar -v', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine());
|
||||
}
|
||||
|
||||
$proc = $pb->setArguments(array('-i'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" composer.phar -i', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine());
|
||||
|
|
@ -129,7 +129,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz'));
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('""^%"path"^%"" "foo "" bar" ""^%"baz"^%"baz"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine());
|
||||
|
|
@ -142,7 +142,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix('%prefix%');
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('""^%"prefix"^%"" arg', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine());
|
||||
|
|
@ -163,7 +163,7 @@ class ProcessBuilderTest extends TestCase
|
|||
->setPrefix('/usr/bin/php')
|
||||
->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
|
@ -175,7 +175,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$process = ProcessBuilder::create(array('/usr/bin/php'))
|
||||
->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
|
@ -210,4 +210,17 @@ class ProcessBuilderTest extends TestCase
|
|||
$builder = ProcessBuilder::create();
|
||||
$builder->setInput(array());
|
||||
}
|
||||
|
||||
public function testDoesNotPrefixExec()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
$builder = ProcessBuilder::create(array('command', '-v', 'ls'));
|
||||
$process = $builder->getProcess();
|
||||
$process->run();
|
||||
|
||||
$this->assertTrue($process->isSuccessful());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php
vendored
Executable file → Normal file
|
|
@ -29,10 +29,12 @@ class ProcessFailedExceptionTest extends TestCase
|
|||
->method('isSuccessful')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
|
||||
'\InvalidArgumentException',
|
||||
'Expected a failed process, but the given process was successful.'
|
||||
);
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Expected a failed process, but the given process was successful.');
|
||||
} else {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'Expected a failed process, but the given process was successful.');
|
||||
}
|
||||
|
||||
new ProcessFailedException($process);
|
||||
}
|
||||
|
|
|
|||
108
pfosten/vendor/symfony/process/Tests/ProcessTest.php
vendored
Executable file → Normal file
108
pfosten/vendor/symfony/process/Tests/ProcessTest.php
vendored
Executable file → Normal file
|
|
@ -33,7 +33,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);
|
||||
|
|
@ -48,9 +48,27 @@ class ProcessTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.
|
||||
*/
|
||||
public function testInvalidCwd()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('False-positive on Windows/appveyor.');
|
||||
}
|
||||
|
||||
// Check that it works fine if the CWD exists
|
||||
$cmd = new Process('echo test', __DIR__);
|
||||
$cmd->run();
|
||||
|
||||
$cmd = new Process('echo test', __DIR__.'/notfound/');
|
||||
$cmd->run();
|
||||
}
|
||||
|
||||
public function testThatProcessDoesNotThrowWarningDuringRun()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is transient on Windows');
|
||||
}
|
||||
@trigger_error('Test Error', E_USER_NOTICE);
|
||||
|
|
@ -140,7 +158,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$o = $p->getOutput();
|
||||
|
||||
$this->assertEquals($expectedOutputSize, strlen($o));
|
||||
$this->assertEquals($expectedOutputSize, \strlen($o));
|
||||
}
|
||||
|
||||
public function testCallbacksAreExecutedWithStart()
|
||||
|
|
@ -182,8 +200,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()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,8 +222,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()
|
||||
|
|
@ -285,7 +303,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
|
|
@ -313,7 +331,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$called = false;
|
||||
$p->run(function ($type, $buffer) use (&$called) {
|
||||
$called = $buffer === 'foo';
|
||||
$called = 'foo' === $buffer;
|
||||
});
|
||||
|
||||
$this->assertTrue($called, 'The callback should be executed with the output');
|
||||
|
|
@ -326,7 +344,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$called = false;
|
||||
$p->run(function ($type, $buffer) use (&$called) {
|
||||
$called = $buffer === 'foo';
|
||||
$called = 'foo' === $buffer;
|
||||
});
|
||||
|
||||
$this->assertTrue($called, 'The callback should be executed with the output');
|
||||
|
|
@ -404,7 +422,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 {
|
||||
|
|
@ -417,7 +435,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -429,9 +447,12 @@ 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');
|
||||
}
|
||||
|
||||
|
|
@ -444,9 +465,12 @@ 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');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -464,7 +488,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
|
|
@ -551,7 +575,7 @@ class ProcessTest extends TestCase
|
|||
{
|
||||
$process = $this->getProcess('echo foo');
|
||||
$process->run();
|
||||
$this->assertTrue(strlen($process->getOutput()) > 0);
|
||||
$this->assertGreaterThan(0, \strlen($process->getOutput()));
|
||||
}
|
||||
|
||||
public function testGetExitCodeIsNullOnStart()
|
||||
|
|
@ -650,7 +674,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -662,7 +686,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -674,7 +698,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -692,7 +716,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.');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild(false);
|
||||
|
|
@ -996,7 +1020,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testWrongSignal($signal)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
|
|
@ -1159,7 +1183,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 {
|
||||
|
|
@ -1219,7 +1243,7 @@ class ProcessTest extends TestCase
|
|||
{
|
||||
$input = new InputStream();
|
||||
|
||||
$process = $this->getProcessForCode('echo \'ping\'; stream_copy_to_stream(STDIN, STDOUT);');
|
||||
$process = $this->getProcessForCode('echo \'ping\'; echo fread(STDIN, 4); echo fread(STDIN, 4);');
|
||||
$process->setInput($input);
|
||||
|
||||
$process->start(function ($type, $data) use ($input) {
|
||||
|
|
@ -1400,6 +1424,7 @@ class ProcessTest extends TestCase
|
|||
public function testEnvBackupDoesNotDeleteExistingVars()
|
||||
{
|
||||
putenv('existing_var=foo');
|
||||
$_ENV['existing_var'] = 'foo';
|
||||
$process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"');
|
||||
$process->setEnv(array('existing_var' => 'bar', 'new_test_var' => 'foo'));
|
||||
$process->inheritEnvironmentVariables();
|
||||
|
|
@ -1409,20 +1434,27 @@ class ProcessTest extends TestCase
|
|||
$this->assertSame('foo', $process->getOutput());
|
||||
$this->assertSame('foo', getenv('existing_var'));
|
||||
$this->assertFalse(getenv('new_test_var'));
|
||||
|
||||
putenv('existing_var');
|
||||
unset($_ENV['existing_var']);
|
||||
}
|
||||
|
||||
public function testEnvIsInherited()
|
||||
{
|
||||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ'));
|
||||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ', 'EMPTY' => ''));
|
||||
|
||||
putenv('FOO=BAR');
|
||||
$_ENV['FOO'] = 'BAR';
|
||||
|
||||
$process->run();
|
||||
|
||||
$expected = array('BAR' => 'BAZ', 'FOO' => 'BAR');
|
||||
$expected = array('BAR' => 'BAZ', 'EMPTY' => '', 'FOO' => 'BAR');
|
||||
$env = array_intersect_key(unserialize($process->getOutput()), $expected);
|
||||
|
||||
$this->assertEquals($expected, $env);
|
||||
|
||||
putenv('FOO');
|
||||
unset($_ENV['FOO']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1433,6 +1465,7 @@ class ProcessTest extends TestCase
|
|||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ'));
|
||||
|
||||
putenv('FOO=BAR');
|
||||
$_ENV['FOO'] = 'BAR';
|
||||
|
||||
$this->assertSame($process, $process->inheritEnvironmentVariables(false));
|
||||
$this->assertFalse($process->areEnvironmentVariablesInherited());
|
||||
|
|
@ -1444,13 +1477,16 @@ class ProcessTest extends TestCase
|
|||
unset($expected['FOO']);
|
||||
|
||||
$this->assertSame($expected, $env);
|
||||
|
||||
putenv('FOO');
|
||||
unset($_ENV['FOO']);
|
||||
}
|
||||
|
||||
public function testGetCommandLine()
|
||||
{
|
||||
$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());
|
||||
}
|
||||
|
||||
|
|
@ -1478,6 +1514,24 @@ class ProcessTest extends TestCase
|
|||
$this->assertSame($arg, $p->getOutput());
|
||||
}
|
||||
|
||||
public function testRawCommandLine()
|
||||
{
|
||||
$p = new Process(sprintf('"%s" -r %s "a" "" "b"', self::$phpBin, escapeshellarg('print_r($argv);')));
|
||||
$p->run();
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Array
|
||||
(
|
||||
[0] => -
|
||||
[1] => a
|
||||
[2] =>
|
||||
[3] => b
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput()));
|
||||
}
|
||||
|
||||
public function provideEscapeArgument()
|
||||
{
|
||||
yield array('a"b%c%');
|
||||
|
|
@ -1492,7 +1546,7 @@ class ProcessTest extends TestCase
|
|||
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'));
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/process/Tests/ProcessUtilsTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/process/Tests/ProcessUtilsTest.php
vendored
Executable file → Normal file
|
|
@ -29,7 +29,7 @@ class ProcessUtilsTest extends TestCase
|
|||
|
||||
public function dataArguments()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array('"\"php\" \"-v\""', '"php" "-v"'),
|
||||
array('"foo bar"', 'foo bar'),
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Tests/SignalListener.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Tests/SignalListener.php
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue