Skip to content

Commit eafcd0a

Browse files
committed
Modernization of run-tests.php
1 parent 98bb5eb commit eafcd0a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

run-tests.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function main()
146146

147147
define('IS_WINDOWS', substr(PHP_OS, 0, 3) == "WIN");
148148

149-
$workerID = getWorkerId();
149+
$workerID = get_worker_id();
150150
if($workerID) {
151151
run_worker($workerID);
152152
return;
@@ -442,7 +442,7 @@ function main()
442442

443443
switch ($switch) {
444444
case 'j':
445-
$workers = getNumberOfWorkers($argv[$i]);
445+
$workers = get_number_of_workers($argv[$i]);
446446
break;
447447
case 'r':
448448
case 'l':
@@ -1373,7 +1373,7 @@ function run_all_tests_parallel($test_files, $env, $redir_tested)
13731373
}
13741374

13751375
// Don't start more workers than test files.
1376-
$workers = max(1, min($workers, count($test_files)));
1376+
$workers = get_max_workers_from_test_files($workers, $test_files);
13771377

13781378
echo "Spawning $workers workers... ";
13791379

@@ -1811,7 +1811,7 @@ function run_test($php, $file, $env)
18111811
}
18121812

18131813
// check for unknown sections
1814-
if (isUnknownSection($section)) {
1814+
if (is_section_unknown($section)) {
18151815
$bork_info = 'Unknown section "' . $section . '"';
18161816
}
18171817

@@ -3600,7 +3600,7 @@ function check_proc_open_function_exists()
36003600

36013601

36023602

3603-
function getNumberOfWorkers($workers): int
3603+
function get_number_of_workers($workers): int
36043604
{
36053605
$cleanWorkers = substr($workers, 2);
36063606
if (!preg_match('/^\d+$/', $cleanWorkers) || $cleanWorkers == 0) {
@@ -3615,12 +3615,12 @@ function getNumberOfWorkers($workers): int
36153615
return $cleanWorkers;
36163616
}
36173617

3618-
function getMaxWorkersFromTestFiles($workers, $testFiles): int
3618+
function get_max_workers_from_test_files($workers, $test_files): int
36193619
{
36203620
return max(1, min($workers, count($test_files)));
36213621
}
36223622

3623-
function getWorkerId(): int
3623+
function get_worker_id(): int
36243624
{
36253625
if (!getenv("TEST_PHP_WORKER")) {
36263626
return 0;
@@ -3629,7 +3629,7 @@ function getWorkerId(): int
36293629
return intval(getenv("TEST_PHP_WORKER"));
36303630
}
36313631

3632-
function isUnknownSection(string $section): bool
3632+
function is_section_unknown(string $section): bool
36333633
{
36343634
return !in_array($section, array(
36353635
'EXPECT', 'EXPECTF', 'EXPECTREGEX', 'EXPECTREGEX_EXTERNAL', 'EXPECT_EXTERNAL', 'EXPECTF_EXTERNAL', 'EXPECTHEADERS',

0 commit comments

Comments
 (0)