com php-src: Allow CLI server test scripts to specify the name of the router file.: sapi/cli/tests/bug61977.phpt sapi/cli/tests/php _cli_server.inc
sapi/cli/tests/php_cli_server_0 09.phpt sapi/cli/tests/php_cli_server_010 .phpt sapi/cli/tests/php_cli_server_013.phpt
sapi/cli/tests/php_cli_server_014.phpt

From: Date: Tue, 06 Jan 2015 01:22:59 +0000
Subject: com php-src: Allow CLI server test scripts to specify the name of the router file.: sapi/cli/tests/bug61977.phpt sapi/cli/tests/php _cli_server.inc
sapi/cli/tests/php_cli_server_0 09.phpt sapi/cli/tests/php_cli_server_010 .phpt sapi/cli/tests/php_cli_server_013.phpt
sapi/cli/tests/php_cli_server_014.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84003@lists.php.net to get a copy of this message
Commit: 0cc2810498a56e263f2e1dd77f1f42e6c53dc99e Author: Adam Harvey <aharvey@php.net> Tue, 6 Jan 2015 01:22:59 +0000 Parents: 339139f876aff8adacec89814c1278608976668f Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0cc2810498a56e263f2e1dd77f1f42e6c53dc99e Log: Allow CLI server test scripts to specify the name of the router file. This is required to write tests that behave differently when an index.php isn't present in the document root. (Such as the one I'm about to commit.) Changed paths: M sapi/cli/tests/bug61977.phpt M sapi/cli/tests/php_cli_server.inc M sapi/cli/tests/php_cli_server_009.phpt M sapi/cli/tests/php_cli_server_010.phpt M sapi/cli/tests/php_cli_server_013.phpt M sapi/cli/tests/php_cli_server_014.phpt Diff: diff --git a/sapi/cli/tests/bug61977.phpt b/sapi/cli/tests/bug61977.phpt index 09a6ba6..d897737 100644 --- a/sapi/cli/tests/bug61977.phpt +++ b/sapi/cli/tests/bug61977.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --FILE-- <?php include "php_cli_server.inc"; -php_cli_server_start('<?php ?>', true); +php_cli_server_start('<?php ?>', null); /* * If a Mime Type is added in php_cli_server.c, add it to this array and update diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 40c5361..c7222b4 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -3,13 +3,12 @@ define ("PHP_CLI_SERVER_HOSTNAME", "localhost"); define ("PHP_CLI_SERVER_PORT", 8964); define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); -function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) { +function php_cli_server_start($code = 'echo "Hello world";', $router = 'index.php') { $php_executable = getenv('TEST_PHP_EXECUTABLE'); $doc_root = __DIR__; - $router = "index.php"; if ($code) { - file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>'); + file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>'); } $descriptorspec = array( @@ -20,14 +19,14 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) if (substr(PHP_OS, 0, 3) == 'WIN') { $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS; - if (!$no_router) { + if (!is_null($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} -n -S " . PHP_CLI_SERVER_ADDRESS; - if (!$no_router) { + if (!is_null($router)) { $cmd .= " {$router}"; } $cmd .= " 2>/dev/null"; diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index 2beaeed..5706af1 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -10,7 +10,7 @@ include "skipif.inc"; --FILE-- <?php include "php_cli_server.inc"; -php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', TRUE); +php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', null); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80; diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt index 2ef018b..20f4e5a 100644 --- a/sapi/cli/tests/php_cli_server_010.phpt +++ b/sapi/cli/tests/php_cli_server_010.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --FILE-- <?php include "php_cli_server.inc"; -php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', TRUE); +php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', null); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80; diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt index 0e3f4ff..3ea3ea9 100644 --- a/sapi/cli/tests/php_cli_server_013.phpt +++ b/sapi/cli/tests/php_cli_server_013.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --FILE-- <?php include "php_cli_server.inc"; -php_cli_server_start(NULL, TRUE); +php_cli_server_start(NULL, NULL); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80; diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt index e8bb5fa..4f812e2 100644 --- a/sapi/cli/tests/php_cli_server_014.phpt +++ b/sapi/cli/tests/php_cli_server_014.phpt @@ -7,7 +7,7 @@ include "skipif.inc"; --FILE-- <?php include "php_cli_server.inc"; -php_cli_server_start('echo done, "\n";', TRUE); +php_cli_server_start('echo done, "\n";', null); list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); $port = intval($port)?:80;

« previous php.cvs (#84003) next »