Skip to content

Commit 8fe7690

Browse files
committed
Modernization of run-tests.php
1 parent 4a42ca3 commit 8fe7690

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… ";
13791379

@@ -1810,7 +1810,7 @@ function run_test($php, $file, $env)
18101810
}
18111811

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

@@ -3599,7 +3599,7 @@ function check_proc_open_function_exists()
35993599

36003600

36013601

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

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

3622-
function getWorkerId(): int
3622+
function get_worker_id(): int
36233623
{
36243624
if (!getenv("TEST_PHP_WORKER")) {
36253625
return 0;
@@ -3628,7 +3628,7 @@ function getWorkerId(): int
36283628
return intval(getenv("TEST_PHP_WORKER"));
36293629
}
36303630

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

0 commit comments

Comments
 (0)