Skip to content

Commit 94df6dc

Browse files
committed
Split test case
This test is failing on AppVeyor almost all of the time, so splitting it seems appropriate. This also allows us to rid php_cli_server_stop() which was only used by this test case.
1 parent df27bfe commit 94df6dc

File tree

4 files changed

+84
-72
lines changed

4 files changed

+84
-72
lines changed

sapi/cli/tests/bug67429.phpt

Lines changed: 0 additions & 55 deletions
This file was deleted.

sapi/cli/tests/bug67429_1.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
FR #67429 (CLI server is missing some new HTTP response codes)
3+
--SKIPIF--
4+
<?php
5+
include "skipif.inc";
6+
?>
7+
--FILE--
8+
<?php
9+
include "php_cli_server.inc";
10+
11+
$proc_handle = php_cli_server_start(<<<PHP
12+
http_response_code(308);
13+
PHP
14+
);
15+
16+
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
17+
$port = intval($port)?:80;
18+
19+
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
20+
if (!$fp) {
21+
die("connect failed");
22+
}
23+
24+
if(fwrite($fp, <<<HEADER
25+
GET / HTTP/1.1
26+
27+
28+
HEADER
29+
)) {
30+
while (!feof($fp)) {
31+
echo fgets($fp);
32+
}
33+
}
34+
35+
fclose($fp);
36+
?>
37+
--EXPECTF--
38+
HTTP/1.1 308 Permanent Redirect
39+
Date: %s
40+
Connection: close
41+
X-Powered-By: %s
42+
Content-type: text/html; charset=UTF-8

sapi/cli/tests/bug67429_2.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
FR #67429 (CLI server is missing some new HTTP response codes)
3+
--SKIPIF--
4+
<?php
5+
include "skipif.inc";
6+
?>
7+
--FILE--
8+
<?php
9+
include "php_cli_server.inc";
10+
11+
$proc_handle = php_cli_server_start(<<<PHP
12+
http_response_code(426);
13+
PHP
14+
);
15+
16+
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
17+
$port = intval($port)?:80;
18+
19+
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
20+
if (!$fp) {
21+
die("connect failed");
22+
}
23+
24+
if(fwrite($fp, <<<HEADER
25+
GET / HTTP/1.1
26+
27+
28+
HEADER
29+
)) {
30+
while (!feof($fp)) {
31+
echo fgets($fp);
32+
}
33+
}
34+
35+
fclose($fp);
36+
?>
37+
--EXPECTF--
38+
HTTP/1.1 426 Upgrade Required
39+
Date: %s
40+
Connection: close
41+
X-Powered-By: %s
42+
Content-type: text/html; charset=UTF-8

sapi/cli/tests/php_cli_server.inc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,4 @@ php_cli_server_start_error:
109109

110110
return $handle;
111111
}
112-
113-
function php_cli_server_stop($handle) {
114-
$success = FALSE;
115-
if ($handle) {
116-
proc_terminate($handle);
117-
/* Wait for server to shutdown */
118-
for ($i = 0; $i < 60; $i++) {
119-
$status = proc_get_status($handle);
120-
if (!($status && $status['running'])) {
121-
$success = TRUE;
122-
break;
123-
}
124-
usleep(50000);
125-
}
126-
}
127-
return $success;
128-
}
129112
?>

0 commit comments

Comments
 (0)