]> granicus.if.org Git - php/commitdiff
Fix test, now can run on windows
authorXinchen Hui <laruence@php.net>
Tue, 25 Oct 2011 10:54:39 +0000 (10:54 +0000)
committerXinchen Hui <laruence@php.net>
Tue, 25 Oct 2011 10:54:39 +0000 (10:54 +0000)
sapi/cli/tests/php_cli_server.inc
sapi/cli/tests/php_cli_server_001.phpt
sapi/cli/tests/php_cli_server_002.phpt
sapi/cli/tests/php_cli_server_003.phpt
sapi/cli/tests/php_cli_server_004.phpt
sapi/cli/tests/php_cli_server_005.phpt
sapi/cli/tests/php_cli_server_006.phpt
sapi/cli/tests/php_cli_server_007.phpt
sapi/cli/tests/php_cli_server_008.phpt
sapi/cli/tests/php_cli_server_009.phpt

index 3f0e026053e721959498db1c5721c78c4af955ee..26abe5492a18849818287580b155e78bdf2c2d96 100644 (file)
@@ -2,7 +2,7 @@
 define ("PHP_CLI_SERVER_ADDRESS", "localhost:8964");
 
 function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) {
-    $php_executable = getenv('TEST_PHP_EXECUTABLE');
+       $php_executable = getenv('TEST_PHP_EXECUTABLE');
        $doc_root = __DIR__;
        $router = "index.php";
        file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>');
@@ -13,21 +13,31 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE)
                2 => STDERR,
        );
 
-       $cmd = "exec {$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+       if (substr(PHP_OS, 0, 3) == 'WIN') {
+               $cmd = "{$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+               if (!$no_router) {
+                       $cmd .= " {$router}";
+               }
 
-       if (!$no_router) {
-               $cmd .= " {$router}";
-       }
+               $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true,  "suppress_errors" => true));
+       } else {
+               $cmd = "exec {$php_executable} -t {$doc_root} -S " . PHP_CLI_SERVER_ADDRESS;
+               if (!$no_router) {
+                       $cmd .= " {$router}";
+               }
+               $cmd .= " 2>/dev/null";
 
-       $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
+               $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
+       }
 
-    register_shutdown_function(
-        function($handle) use($router) {
-            proc_terminate($handle);
-            @unlink(__DIR__ . "/{$router}");
-        },
-        $handle
-    );
+       register_shutdown_function(
+               function($handle) use($router) {
+                       proc_terminate($handle);
+                       @unlink(__DIR__ . "/{$router}");
+               },
+                       $handle
+               );
        usleep(50000);
 }
 ?>
+
index 27c81bb6ba8e67201d0a7a4eae4ffc667b649b6f..3f1083e7ac898f96931b0ed15a2e632cdfdc32b7 100644 (file)
@@ -5,9 +5,6 @@ allow_url_fopen=1
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index e1120d61bf34586732e3745675249b2099c5dfdb..ee5b9c58da4c276e35b205952fbf86a5a0aaa3c9 100644 (file)
@@ -5,9 +5,6 @@ allow_url_fopen=1
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index 8e7f11fed737b0169edca2aba498684673cd6f9f..428ee808029259314bb1f98eceaac339458a4c85 100644 (file)
@@ -5,9 +5,6 @@ allow_url_fopen=1
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index 804e0bfbdab944c3380f9c807bfb869f31cbb0a4..313159b7e053961c67ea4f0780b328a19afb9a1b 100644 (file)
@@ -5,9 +5,6 @@ allow_url_fopen=1
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index b94b5b8a3712a133b6a441ba7b83d0517080b0dd..c8665dec1863b595a7b888d67d34aa472d4c6c1e 100644 (file)
@@ -3,9 +3,6 @@ Post a file
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index d23b6d3ca62e289a30d6bd7cb13862bbfef6f820..7ff1c99b7a0a5476bdfbdef5cf08e6f45e3d8077 100644 (file)
@@ -3,9 +3,6 @@ Bug #55755 (SegFault when outputting header WWW-Authenticate)
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index a584d07b37d9a35e0bcf9c3388611d11368c0721..c3d86324ed59364fa4c3d2ab734ec694d62e457f 100644 (file)
@@ -3,9 +3,6 @@ Bug #55758 (Digest Authenticate missed in 5.4)
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index 390bf019a28791733018a2f96da1ac144c7aaa8b..c0b7516e006898485d8b284e56a8226839f6dca8 100644 (file)
@@ -3,9 +3,6 @@ SERVER_PROTOCOL header availability
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
index 311e53155d74e6aadb8e2f142c5ea9c9449f6bdc..5f2e41c3fd3f3a9e216759c934181462dcda9ddd 100644 (file)
@@ -6,9 +6,6 @@ now could serve correctly with request_uri "index.php" and PATH_INFO "/foo/bar/"
 --SKIPIF--
 <?php
 include "skipif.inc"; 
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die ("skip not for Windows");
-}
 ?>
 --FILE--
 <?php
@@ -79,7 +76,6 @@ HEADER
 fclose($fp);
 ?>
 --EXPECTF--
-[%s] %s
 HTTP/1.1 200 OK
 Host: %s
 Connection: closed
@@ -87,7 +83,6 @@ X-Powered-By: PHP/%s-dev
 Content-type: text/html
 
 string(8) "/foo/bar"
-[%s] %s
 HTTP/1.0 200 OK
 Host: %s
 Connection: closed
@@ -95,5 +90,4 @@ X-Powered-By: PHP/%s-dev
 Content-type: text/html
 
 string(9) "/foo/bar/"
-[%s] %s
 HTTP/1.0 404 Not Found