com php-src: add test for fastcgi_finish_request(): sapi/fpm/tests/017.phpt
| From: | Remi Collet | Date: | Fri, 21 Nov 2014 10:28:20 +0000 |
| Subject: | com php-src: add test for fastcgi_finish_request(): sapi/fpm/tests/017.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83221@lists.php.net to get a copy of this message | ||
Commit: 1e14f805f9d5798bcf71334ee61eb5f85916599e
Author: Remi Collet <remi@php.net> Fri, 21 Nov 2014 11:28:20 +0100
Parents: 0581e877a500a77e31a991ee56fd92a0c93ed4cb
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1e14f805f9d5798bcf71334ee61eb5f85916599e
Log:
add test for fastcgi_finish_request()
Changed paths:
A sapi/fpm/tests/017.phpt
Diff:
diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt
new file mode 100644
index 0000000..ea0738a
--- /dev/null
+++ b/sapi/fpm/tests/017.phpt
@@ -0,0 +1,67 @@
+--TEST--
+FPM: Test fastcgi_finish_request function
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = __DIR__.'/php-fpm.log.tmp';
+$srcfile = __DIR__.'/php-fpm.tmp.php';
+$port = 9000+PHP_INT_SIZE;
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+[unconfined]
+listen = 127.0.0.1:$port
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 1
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+EOT;
+
+$code = <<<EOT
+<?php
+echo "Test Start\n";
+fastcgi_finish_request();
+echo "Test End\n";
+EOT;
+file_put_contents($srcfile, $code);
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ $req = run_request('127.0.0.1', $port, $srcfile);
+ echo strstr($req, "Test Start");
+ echo "Request ok\n";
+ } catch (Exception $e) {
+ echo "Request error\n";
+ }
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+}
+
+?>
+Done
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Test Start
+
+Request ok
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+Done
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $srcfile = __DIR__.'/php-fpm.log.tmp';
+ @unlink($logfile);
+ @unlink($srcfile);
+?>
\ No newline at end of file