Merge branch '2.5' into 2.6
* 2.5: [Form] Remove a redundant test. use value of DIRECTORY_SEPARATOR to detect Windows Conflicts: src/Symfony/Component/Process/Process.php
This commit is contained in:
commit
67904e12dc
@ -91,7 +91,7 @@ EOF
|
||||
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
|
||||
|
||||
$filesystem->rename($realCacheDir, $oldCacheDir);
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
sleep(1); // workaround for Windows PHP rename bug
|
||||
}
|
||||
$filesystem->rename($warmupDir, $realCacheDir);
|
||||
|
@ -30,7 +30,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
||||
*/
|
||||
public function testRoutingErrorIsExposedWhenNotProtected($config)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
|
||||
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
||||
*/
|
||||
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50309) {
|
||||
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ class Application
|
||||
return $this->terminalDimensions;
|
||||
}
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// extract [w, H] from "wxh (WxH)"
|
||||
if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
|
||||
return array((int) $matches[1], (int) $matches[2]);
|
||||
|
@ -262,7 +262,7 @@ class DialogHelper extends InputAwareHelper
|
||||
*/
|
||||
public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
|
||||
|
||||
// handle code running from a phar
|
||||
|
@ -100,7 +100,7 @@ class DialogHelperTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAskHiddenResponse()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is not supported on Windows');
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ class Filesystem
|
||||
}
|
||||
} else {
|
||||
// https://bugs.php.net/bug.php?id=52176
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($file)) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && is_dir($file)) {
|
||||
if (true !== @rmdir($file)) {
|
||||
throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file);
|
||||
}
|
||||
@ -307,7 +307,7 @@ class Filesystem
|
||||
if (true !== @symlink($originDir, $targetDir)) {
|
||||
$report = error_get_last();
|
||||
if (is_array($report)) {
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR') && false !== strpos($report['message'], 'error code(1314)')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
|
||||
throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ class Filesystem
|
||||
public function makePathRelative($endPath, $startPath)
|
||||
{
|
||||
// Normalize separators on Windows
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$endPath = strtr($endPath, '\\', '/');
|
||||
$startPath = strtr($startPath, '\\', '/');
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
array('/a/aab/bb/', '/a/aa/', '../aab/bb/'),
|
||||
);
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$paths[] = array('c:\var\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/');
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
|
||||
// skip mode check on Windows
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(753, $filename);
|
||||
}
|
||||
}
|
||||
@ -980,7 +980,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
|
||||
// skip mode check on Windows
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(600, $filename);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
||||
{
|
||||
$filename = $this->current()->getRelativePathname();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$filename = strtr($filename, '\\', '/');
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
*/
|
||||
public function testAccessDeniedException(Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
@ -784,7 +784,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
*/
|
||||
public function testIgnoredAccessDeniedException(Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
|
@ -279,37 +279,6 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
||||
$this->assertSame($valid, $form->isValid());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideBoolean
|
||||
*/
|
||||
public function testValidateTokenOnBindIfRootAndCompoundUsesTypeClassAsIntentionIfEmptyFormName($valid)
|
||||
{
|
||||
$this->tokenManager->expects($this->once())
|
||||
->method('isTokenValid')
|
||||
->with(new CsrfToken('Symfony\Component\Form\Extension\Core\Type\FormType', 'token'))
|
||||
->will($this->returnValue($valid));
|
||||
|
||||
$form = $this->factory
|
||||
->createNamedBuilder('', 'form', null, array(
|
||||
'csrf_field_name' => 'csrf',
|
||||
'csrf_token_manager' => $this->tokenManager,
|
||||
'compound' => true,
|
||||
))
|
||||
->add('child', 'text')
|
||||
->getForm();
|
||||
|
||||
$form->submit(array(
|
||||
'child' => 'foobar',
|
||||
'csrf' => 'token',
|
||||
));
|
||||
|
||||
// Remove token from data
|
||||
$this->assertSame(array('child' => 'foobar'), $form->getData());
|
||||
|
||||
// Validate accordingly
|
||||
$this->assertSame($valid, $form->isValid());
|
||||
}
|
||||
|
||||
public function testFailIfRootAndCompoundAndTokenMissing()
|
||||
{
|
||||
$this->tokenManager->expects($this->never())
|
||||
|
@ -45,7 +45,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
|
||||
return '\\' !== DIRECTORY_SEPARATOR && function_exists('passthru') && function_exists('escapeshellarg');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGuessWithNonReadablePath()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can not verify chmod operations on Windows');
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ EOF;
|
||||
|
||||
// Heredocs are preserved, making the output mixing Unix and Windows line
|
||||
// endings, switching to "\n" everywhere on Windows to avoid failure.
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$expected = str_replace("\r\n", "\n", $expected);
|
||||
$output = str_replace("\r\n", "\n", $output);
|
||||
}
|
||||
|
@ -72,13 +72,13 @@ class ExecutableFinder
|
||||
}
|
||||
|
||||
$suffixes = array('');
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$pathExt = getenv('PATHEXT');
|
||||
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (defined('PHP_WINDOWS_VERSION_BUILD') || is_executable($file))) {
|
||||
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class PhpExecutableFinder
|
||||
}
|
||||
|
||||
$dirs = array(PHP_BINDIR);
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$dirs[] = 'C:\xampp\php\\';
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class Process
|
||||
// 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') || defined('PHP_WINDOWS_VERSION_BUILD'))) {
|
||||
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
|
||||
$this->cwd = getcwd();
|
||||
}
|
||||
if (null !== $env) {
|
||||
@ -164,10 +164,10 @@ class Process
|
||||
|
||||
$this->input = $input;
|
||||
$this->setTimeout($timeout);
|
||||
$this->useFileHandles = defined('PHP_WINDOWS_VERSION_BUILD');
|
||||
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
|
||||
$this->pty = false;
|
||||
$this->enhanceWindowsCompatibility = true;
|
||||
$this->enhanceSigchildCompatibility = !defined('PHP_WINDOWS_VERSION_BUILD') && $this->isSigchildEnabled();
|
||||
$this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
|
||||
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ class Process
|
||||
|
||||
$commandline = $this->commandline;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->enhanceWindowsCompatibility) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
|
||||
$commandline = 'cmd /V:ON /E:ON /C "('.$commandline.')';
|
||||
foreach ($this->processPipes->getFiles() as $offset => $filename) {
|
||||
$commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
|
||||
@ -356,8 +356,8 @@ class Process
|
||||
|
||||
do {
|
||||
$this->checkTimeout();
|
||||
$running = defined('PHP_WINDOWS_VERSION_BUILD') ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$close = !defined('PHP_WINDOWS_VERSION_BUILD') || !$running;
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$close = '\\' !== DIRECTORY_SEPARATOR || !$running;
|
||||
$this->readPipes(true, $close);
|
||||
} while ($running);
|
||||
|
||||
@ -476,7 +476,7 @@ class Process
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stdout;
|
||||
}
|
||||
@ -535,7 +535,7 @@ class Process
|
||||
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
$this->readPipes(false, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
return $this->stderr;
|
||||
}
|
||||
@ -787,7 +787,7 @@ class Process
|
||||
{
|
||||
$timeoutMicro = microtime(true) + $timeout;
|
||||
if ($this->isRunning()) {
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && !$this->isSigchildEnabled()) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
|
||||
exec(sprintf("taskkill /F /T /PID %d 2>&1", $this->getPid()), $output, $exitCode);
|
||||
if ($exitCode > 0) {
|
||||
throw new RuntimeException('Unable to kill the process');
|
||||
@ -936,7 +936,7 @@ class Process
|
||||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $tty) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
|
||||
throw new RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
|
||||
@ -1310,7 +1310,7 @@ class Process
|
||||
$this->processInformation = proc_get_status($this->process);
|
||||
$this->captureExitCode();
|
||||
|
||||
$this->readPipes($blocking, defined('PHP_WINDOWS_VERSION_BUILD') ? !$this->processInformation['running'] : true);
|
||||
$this->readPipes($blocking, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
|
||||
|
||||
if (!$this->processInformation['running']) {
|
||||
$this->close();
|
||||
|
@ -42,7 +42,7 @@ class ProcessUtils
|
||||
//Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
|
||||
//@see https://bugs.php.net/bug.php?id=43784
|
||||
//@see https://bugs.php.net/bug.php?id=49446
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('' === $argument) {
|
||||
return escapeshellarg($argument);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
@ -348,7 +348,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testZeroAsOutput()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
|
||||
$p = $this->getProcess('echo | set /p dummyName=0');
|
||||
} else {
|
||||
@ -361,7 +361,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYCommand()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYCommandExitCode()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -580,7 +580,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithoutTermSignalIsNotSignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessWithTermSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testProcessThrowsExceptionWhenExternallySignaled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
@ -691,7 +691,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
// Windows is a bit slower as it read file handles, then allow twice the precision
|
||||
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
|
||||
} else {
|
||||
@ -908,7 +908,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function verifyPosixIsEnabled()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
if (!defined('SIGUSR1')) {
|
||||
@ -921,7 +921,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSignalWithWrongIntSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
@ -935,7 +935,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSignalWithWrongNonIntSignal()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
@ -1063,7 +1063,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
|
||||
);
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
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 {
|
||||
|
@ -94,7 +94,7 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->markTestSkipped('Requires the PHP_BINARY constant');
|
||||
}
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
@ -142,6 +142,6 @@ class ExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, defined('PHP_WINDOWS_VERSION_BUILD') ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
$current = $f->find();
|
||||
|
||||
//TODO maybe php executable is custom or even Windows
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertTrue(is_executable($current));
|
||||
$this->assertTrue((bool) preg_match('/'.addSlashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
|
||||
}
|
||||
|
@ -102,14 +102,14 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb->setPrefix('/usr/bin/php');
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
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 (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" "-i"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine());
|
||||
@ -141,7 +141,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz'));
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('^%"path"^% "foo \\" bar" "%baz%baz"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine());
|
||||
@ -154,7 +154,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$pb->setPrefix('%prefix%');
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('^%"prefix"^% "arg"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine());
|
||||
@ -175,7 +175,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
->setPrefix('/usr/bin/php')
|
||||
->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
@ -187,7 +187,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$process = ProcessBuilder::create(array('/usr/bin/php'))
|
||||
->getProcess();
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
@ -25,7 +25,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function dataArguments()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array('"\"php\" \"-v\""', '"php" "-v"'),
|
||||
array('"foo bar"', 'foo bar'),
|
||||
|
@ -114,7 +114,7 @@ class SigchildEnabledProcessTest extends AbstractProcessTest
|
||||
|
||||
public function testStartAfterATimeout()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Restarting a timed-out process on Windows is not supported in sigchild environment');
|
||||
}
|
||||
parent::testStartAfterATimeout();
|
||||
|
@ -43,7 +43,7 @@ final class SecureRandom implements SecureRandomInterface
|
||||
$this->logger = $logger;
|
||||
|
||||
// determine whether to use OpenSSL
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50304) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID < 50304) {
|
||||
$this->useOpenSsl = false;
|
||||
} elseif (!function_exists('openssl_random_pseudo_bytes')) {
|
||||
if (null !== $this->logger) {
|
||||
|
Reference in New Issue
Block a user