Skip to content

Commit

Permalink
Revert "Apply cs"
Browse files Browse the repository at this point in the history
  • Loading branch information
vadim-tpg committed Jun 26, 2019
1 parent 3946b63 commit 90a255f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php
Expand Up @@ -78,11 +78,11 @@
$PHP .= ' -qrr';
}

$defaultEnvs = [
$defaultEnvs = array(
'COMPOSER' => 'composer.json',
'COMPOSER_VENDOR_DIR' => 'vendor',
'COMPOSER_BIN_DIR' => 'bin',
];
);

foreach ($defaultEnvs as $envName => $envValue) {
if ($envValue !== getenv($envName)) {
Expand All @@ -95,17 +95,18 @@
? $PHP.' '.escapeshellarg($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': ''));

if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__)."\n".$SYMFONY_PHPUNIT_REMOVE !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
// Build a standalone phpunit without symfony/yaml nor prophecy by default

@mkdir($PHPUNIT_DIR, 0777, true);
chdir($PHPUNIT_DIR);
if (file_exists("phpunit-$PHPUNIT_VERSION")) {
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL' : 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
rename("phpunit-$PHPUNIT_VERSION", "phpunit-$PHPUNIT_VERSION.old");
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
}
passthru("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");
chdir("phpunit-$PHPUNIT_VERSION");
Expand All @@ -127,7 +128,7 @@
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", [], $p, getcwd(), null, ['bypass_shell' => false]));
$exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => false)));
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
if ($exit) {
exit($exit);
Expand Down Expand Up @@ -156,12 +157,13 @@ class SymfonyBlacklistPhpunit {}
chdir('..');
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__)."\n".$SYMFONY_PHPUNIT_REMOVE);
chdir($oldPwd);

}

global $argv, $argc;
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : [];
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
$components = [];
$components = array();
$cmd = array_map('escapeshellarg', $argv);
$exit = 0;

Expand Down Expand Up @@ -196,7 +198,7 @@ class SymfonyBlacklistPhpunit {}

if ($components) {
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
$runningProcs = [];
$runningProcs = array();

foreach ($components as $component) {
// Run phpunit tests in parallel
Expand All @@ -207,7 +209,7 @@ class SymfonyBlacklistPhpunit {}

$c = escapeshellarg($component);

if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), [], $pipes)) {
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) {
$runningProcs[$component] = $proc;
} else {
$exit = 1;
Expand All @@ -217,7 +219,7 @@ class SymfonyBlacklistPhpunit {}

while ($runningProcs) {
usleep(300000);
$terminatedProcs = [];
$terminatedProcs = array();
foreach ($runningProcs as $component => $proc) {
$procStatus = proc_get_status($proc);
if (!$procStatus['running']) {
Expand All @@ -228,7 +230,7 @@ class SymfonyBlacklistPhpunit {}
}

foreach ($terminatedProcs as $component => $procStatus) {
foreach (['out', 'err'] as $file) {
foreach (array('out', 'err') as $file) {
$file = "$component/phpunit.std$file";
readfile($file);
unlink($file);
Expand All @@ -238,7 +240,7 @@ class SymfonyBlacklistPhpunit {}
// STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
// STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
// STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, [-1073740791, -1073741819, -1073740940]))) {
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) {
$exit = $procStatus;
echo "\033[41mKO\033[0m $component\n\n";
} else {
Expand All @@ -248,11 +250,9 @@ class SymfonyBlacklistPhpunit {}
}
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
class SymfonyBlacklistSimplePhpunit
{
}
class SymfonyBlacklistSimplePhpunit {}
}
array_splice($argv, 1, 0, ['--colors=always']);
array_splice($argv, 1, 0, array('--colors=always'));
$_SERVER['argv'] = $argv;
$_SERVER['argc'] = ++$argc;
include "$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit";
Expand Down

0 comments on commit 90a255f

Please sign in to comment.