]> granicus.if.org Git - php/commitdiff
Fixed sapi/tests (maybe needs some run-test.php people's reviewing)
authorXinchen Hui <laruence@php.net>
Wed, 27 May 2015 09:37:34 +0000 (17:37 +0800)
committerXinchen Hui <laruence@php.net>
Wed, 27 May 2015 09:37:34 +0000 (17:37 +0800)
run-tests.php
sapi/tests/test005.phpt
sapi/tests/test006.phpt

index 897500a58b3561d275a2f2fb984f3d0b5f50e15d..cbc43595ff36e85781fdbd07bb14e18defc5809a 100755 (executable)
@@ -1662,9 +1662,15 @@ TEST $file
        }
 
        $env['REDIRECT_STATUS'] = '1';
-       $env['QUERY_STRING']    = $query_string;
-       $env['PATH_TRANSLATED'] = $test_file;
-       $env['SCRIPT_FILENAME'] = $test_file;
+       if (empty($env['QUERY_STRING'])) {
+               $env['QUERY_STRING']    = $query_string;
+       }
+       if (empty($env['PATH_TRANSLATED'])) {
+               $env['PATH_TRANSLATED'] = $test_file;
+       }
+       if (empty($env['SCRIPT_FILENAME'])) {
+               $env['SCRIPT_FILENAME'] = $test_file;
+       }
 
        if (array_key_exists('COOKIE', $section_text)) {
                $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
@@ -1745,12 +1751,18 @@ TEST $file
        } else if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
 
                $post = trim($section_text['POST']);
-               save_text($tmp_post, $post);
+               file_put_contents("/tmp/post", $post);
                $content_length = strlen($post);
+               save_text($tmp_post, $post);
 
                $env['REQUEST_METHOD'] = 'POST';
-               $env['CONTENT_TYPE']   = 'application/x-www-form-urlencoded';
-               $env['CONTENT_LENGTH'] = $content_length;
+               if (empty($env['CONTENT_TYPE'])) {
+                       $env['CONTENT_TYPE']   = 'application/x-www-form-urlencoded';
+               }
+
+               if (empty($env['CONTENT_LENGTH'])) {
+                       $env['CONTENT_LENGTH'] = $content_length;
+               }
 
                $cmd = "$php $pass_options $ini_settings -f \"$test_file\" 2>&1 < \"$tmp_post\"";
 
index 7415b66a0a78f9a0da4b65003e7161b74ba63efb..85143d52285d2d4f46bc651a56631c1f5774987a 100644 (file)
@@ -22,6 +22,6 @@ END;
     echo "HELLO";
 ?>
 --EXPECTHEADERS--
-Status: 404
+Status: 404 Not Found
 --EXPECT--
-No input file specified.
\ No newline at end of file
+No input file specified.
index 45e37811ef71e43f2c2784211842cd4adf5d8a57..16d1b2b84041999508d744cd2f84daa5caaf3d21 100644 (file)
@@ -67,7 +67,7 @@ Array
             [type] => application/octet-stream
             [tmp_name] => %s
             [error] => 0
-            [size] => 21
+            [size] => 19
         )
 
 )