Merge branch '4.4' into 5.0
* 4.4: [Process] - update @throws phpdoc [PHPUnitBridge] file_get_contents() expects parameter 3 to be resource [PHPUnit-Bridge] Fail-fast in simple-phpunit if one of the passthru() commands fails [HttpKernel][FileLocator] Fix deprecation message
This commit is contained in:
commit
8031b864c3
@ -53,6 +53,14 @@ $getEnvVar = function ($name, $default = false) use ($argv) {
|
|||||||
return $default;
|
return $default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$passthruOrFail = function ($command) {
|
||||||
|
passthru($command, $status);
|
||||||
|
|
||||||
|
if ($status) {
|
||||||
|
exit($status);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70200) {
|
if (PHP_VERSION_ID >= 70200) {
|
||||||
// PHPUnit 8 requires PHP 7.2+
|
// PHPUnit 8 requires PHP 7.2+
|
||||||
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.3');
|
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '8.3');
|
||||||
@ -63,9 +71,10 @@ if (PHP_VERSION_ID >= 70200) {
|
|||||||
// PHPUnit 6 requires PHP 7.0+
|
// PHPUnit 6 requires PHP 7.0+
|
||||||
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '6.5');
|
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '6.5');
|
||||||
} elseif (PHP_VERSION_ID >= 50600) {
|
} elseif (PHP_VERSION_ID >= 50600) {
|
||||||
// PHPUnit 5 requires PHP 5.6+
|
// PHPUnit 4 does not support PHP 7
|
||||||
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '5.7');
|
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '5.7');
|
||||||
} else {
|
} else {
|
||||||
|
// PHPUnit 5.1 requires PHP 5.6+
|
||||||
$PHPUNIT_VERSION = '4.8';
|
$PHPUNIT_VERSION = '4.8';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +115,7 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
|
|||||||
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
|
||||||
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
|
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
|
||||||
|| file_exists($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).DIRECTORY_SEPARATOR.'composer.phar')
|
|| file_exists($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).DIRECTORY_SEPARATOR.'composer.phar')
|
||||||
? (file_get_contents($COMPOSER, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
? (file_get_contents($COMPOSER, false, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
|
||||||
: 'composer';
|
: 'composer';
|
||||||
|
|
||||||
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml': ''));
|
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml': ''));
|
||||||
@ -122,25 +131,25 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
|||||||
rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
|
||||||
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
|
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
|
||||||
}
|
}
|
||||||
passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
|
||||||
chdir("$PHPUNIT_VERSION_DIR");
|
chdir("$PHPUNIT_VERSION_DIR");
|
||||||
if ($SYMFONY_PHPUNIT_REMOVE) {
|
if ($SYMFONY_PHPUNIT_REMOVE) {
|
||||||
passthru("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE);
|
$passthruOrFail("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE);
|
||||||
}
|
}
|
||||||
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
|
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
|
||||||
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
|
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
passthru("$COMPOSER config --unset platform");
|
$passthruOrFail("$COMPOSER config --unset platform");
|
||||||
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
|
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
|
||||||
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
|
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
|
||||||
passthru("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path)));
|
$passthruOrFail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $path)));
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||||
file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
|
file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
passthru("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
|
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
|
||||||
}
|
}
|
||||||
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
|
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
|
||||||
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
|
||||||
@ -206,7 +215,7 @@ if (isset($argv[1]) && 'symfony' === $argv[1] && !file_exists('symfony') && file
|
|||||||
$argv[1] = 'src/Symfony';
|
$argv[1] = 'src/Symfony';
|
||||||
}
|
}
|
||||||
if (isset($argv[1]) && is_dir($argv[1]) && !file_exists($argv[1].'/phpunit.xml.dist')) {
|
if (isset($argv[1]) && is_dir($argv[1]) && !file_exists($argv[1].'/phpunit.xml.dist')) {
|
||||||
// Find Symfony components in plain PHP for Windows portability
|
// Find Symfony components in plain php for Windows portability
|
||||||
|
|
||||||
$finder = new RecursiveDirectoryIterator($argv[1], FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
|
$finder = new RecursiveDirectoryIterator($argv[1], FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
|
||||||
$finder = new RecursiveIteratorIterator($finder);
|
$finder = new RecursiveIteratorIterator($finder);
|
||||||
|
@ -135,7 +135,7 @@ class Process implements \IteratorAggregate
|
|||||||
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
|
* @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input
|
||||||
* @param int|float|null $timeout The timeout in seconds or null to disable
|
* @param int|float|null $timeout The timeout in seconds or null to disable
|
||||||
*
|
*
|
||||||
* @throws RuntimeException When proc_open is not installed
|
* @throws LogicException When proc_open is not installed
|
||||||
*/
|
*/
|
||||||
public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||||
{
|
{
|
||||||
@ -184,7 +184,7 @@ class Process implements \IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*
|
*
|
||||||
* @throws RuntimeException When proc_open is not installed
|
* @throws LogicException When proc_open is not installed
|
||||||
*/
|
*/
|
||||||
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||||
{
|
{
|
||||||
@ -219,9 +219,11 @@ class Process implements \IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return int The exit status code
|
* @return int The exit status code
|
||||||
*
|
*
|
||||||
* @throws RuntimeException When process can't be launched
|
* @throws RuntimeException When process can't be launched
|
||||||
* @throws RuntimeException When process stopped after receiving signal
|
* @throws RuntimeException When process is already running
|
||||||
* @throws LogicException In case a callback is provided and output has been disabled
|
* @throws ProcessTimedOutException When process timed out
|
||||||
|
* @throws ProcessSignaledException When process stopped after receiving signal
|
||||||
|
* @throws LogicException In case a callback is provided and output has been disabled
|
||||||
*
|
*
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
@ -389,9 +391,9 @@ class Process implements \IteratorAggregate
|
|||||||
*
|
*
|
||||||
* @return int The exitcode of the process
|
* @return int The exitcode of the process
|
||||||
*
|
*
|
||||||
* @throws RuntimeException When process timed out
|
* @throws ProcessTimedOutException When process timed out
|
||||||
* @throws RuntimeException When process stopped after receiving signal
|
* @throws ProcessSignaledException When process stopped after receiving signal
|
||||||
* @throws LogicException When process is not yet started
|
* @throws LogicException When process is not yet started
|
||||||
*/
|
*/
|
||||||
public function wait(callable $callback = null)
|
public function wait(callable $callback = null)
|
||||||
{
|
{
|
||||||
@ -402,7 +404,7 @@ class Process implements \IteratorAggregate
|
|||||||
if (null !== $callback) {
|
if (null !== $callback) {
|
||||||
if (!$this->processPipes->haveReadSupport()) {
|
if (!$this->processPipes->haveReadSupport()) {
|
||||||
$this->stop(0);
|
$this->stop(0);
|
||||||
throw new \LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait"');
|
throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait"');
|
||||||
}
|
}
|
||||||
$this->callback = $this->buildCallback($callback);
|
$this->callback = $this->buildCallback($callback);
|
||||||
}
|
}
|
||||||
@ -432,8 +434,9 @@ class Process implements \IteratorAggregate
|
|||||||
* from the output in real-time while writing the standard input to the process.
|
* from the output in real-time while writing the standard input to the process.
|
||||||
* It allows to have feedback from the independent process during execution.
|
* It allows to have feedback from the independent process during execution.
|
||||||
*
|
*
|
||||||
* @throws RuntimeException When process timed out
|
* @throws RuntimeException When process timed out
|
||||||
* @throws LogicException When process is not yet started
|
* @throws LogicException When process is not yet started
|
||||||
|
* @throws ProcessTimedOutException In case the timeout was reached
|
||||||
*/
|
*/
|
||||||
public function waitUntil(callable $callback): bool
|
public function waitUntil(callable $callback): bool
|
||||||
{
|
{
|
||||||
@ -442,7 +445,7 @@ class Process implements \IteratorAggregate
|
|||||||
|
|
||||||
if (!$this->processPipes->haveReadSupport()) {
|
if (!$this->processPipes->haveReadSupport()) {
|
||||||
$this->stop(0);
|
$this->stop(0);
|
||||||
throw new \LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
|
throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
|
||||||
}
|
}
|
||||||
$callback = $this->buildCallback($callback);
|
$callback = $this->buildCallback($callback);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user