mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-25 04:09:11 -04:00
ALPHA 3.0.2a
This commit is contained in:
@@ -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