Skip to content

Commit c170293

Browse files
committed
Fixed sapi/tests (maybe needs some run-test.php people's reviewing)
1 parent 2b41c04 commit c170293

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

run-tests.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,9 +1662,15 @@ function run_test($php, $file, $env)
16621662
}
16631663

16641664
$env['REDIRECT_STATUS'] = '1';
1665-
$env['QUERY_STRING'] = $query_string;
1666-
$env['PATH_TRANSLATED'] = $test_file;
1667-
$env['SCRIPT_FILENAME'] = $test_file;
1665+
if (empty($env['QUERY_STRING'])) {
1666+
$env['QUERY_STRING'] = $query_string;
1667+
}
1668+
if (empty($env['PATH_TRANSLATED'])) {
1669+
$env['PATH_TRANSLATED'] = $test_file;
1670+
}
1671+
if (empty($env['SCRIPT_FILENAME'])) {
1672+
$env['SCRIPT_FILENAME'] = $test_file;
1673+
}
16681674

16691675
if (array_key_exists('COOKIE', $section_text)) {
16701676
$env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
@@ -1745,12 +1751,18 @@ function run_test($php, $file, $env)
17451751
} else if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
17461752

17471753
$post = trim($section_text['POST']);
1748-
save_text($tmp_post, $post);
1754+
file_put_contents("/tmp/post", $post);
17491755
$content_length = strlen($post);
1756+
save_text($tmp_post, $post);
17501757

17511758
$env['REQUEST_METHOD'] = 'POST';
1752-
$env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
1753-
$env['CONTENT_LENGTH'] = $content_length;
1759+
if (empty($env['CONTENT_TYPE'])) {
1760+
$env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
1761+
}
1762+
1763+
if (empty($env['CONTENT_LENGTH'])) {
1764+
$env['CONTENT_LENGTH'] = $content_length;
1765+
}
17541766

17551767
$cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\"";
17561768

sapi/tests/test005.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ END;
2222
echo "HELLO";
2323
?>
2424
--EXPECTHEADERS--
25-
Status: 404
25+
Status: 404 Not Found
2626
--EXPECT--
27-
No input file specified.
27+
No input file specified.

sapi/tests/test006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Array
6767
[type] => application/octet-stream
6868
[tmp_name] => %s
6969
[error] => 0
70-
[size] => 21
70+
[size] => 19
7171
)
7272

7373
)

0 commit comments

Comments
 (0)