diff options
| author | Jakub Zelenka <bukka@php.net> | 2018-07-07 12:48:16 +0100 |
|---|---|---|
| committer | Jakub Zelenka <bukka@php.net> | 2018-07-07 12:48:16 +0100 |
| commit | f86f3edeef67ecc10fd6dfeb0b9d28331962c895 (patch) | |
| tree | 22a4a66b8ea2d4d04cf1402e1a06c5402226f188 | |
| parent | 140def4ac712acac6e2561f65e1b72f8efad8717 (diff) | |
| download | php-git-f86f3edeef67ecc10fd6dfeb0b9d28331962c895.tar.gz | |
Migrate fpm_get_status test
| -rw-r--r-- | sapi/fpm/tests/fpm_get_status_basic.phpt (renamed from sapi/fpm/tests/025.phpt) | 48 | ||||
| -rw-r--r-- | sapi/fpm/tests/response.inc | 2 |
2 files changed, 15 insertions, 35 deletions
diff --git a/sapi/fpm/tests/025.phpt b/sapi/fpm/tests/fpm_get_status_basic.phpt index c3bd388db6..a53fef2437 100644 --- a/sapi/fpm/tests/025.phpt +++ b/sapi/fpm/tests/fpm_get_status_basic.phpt @@ -1,21 +1,17 @@ --TEST-- -FPM: Test fpm_get_status function +FPM: Function fpm_get_status basic test --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; +require_once "tester.inc"; $cfg = <<<EOT [global] -error_log = $logfile +error_log = {{FILE:LOG}} [unconfined] -listen = 127.0.0.1:$port +listen = {{ADDR}} pm = dynamic pm.max_children = 5 pm.start_servers = 1 @@ -29,29 +25,19 @@ echo "Test Start\n"; var_dump(fpm_get_status()); 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); - fpm_display_log($tail, -1); - fclose($tail); - proc_close($fpm); -} +$headers = []; +$tester = new FPM\Tester($cfg, $code); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->request()->printBody(); +$tester->terminate(); +$tester->expectLogTerminatingNotices(); +$tester->close(); ?> Done --EXPECTF-- -[%s] NOTICE: fpm is running, pid %d -[%s] NOTICE: ready to handle connections Test Start array(15) { ["pool"]=> @@ -118,15 +104,9 @@ array(15) { } } Test End - -Request ok -[%s] NOTICE: Terminating ... -[%s] NOTICE: exiting, bye-bye! Done --CLEAN-- <?php - $logfile = __DIR__.'/php-fpm.log.tmp'; - $srcfile = __DIR__.'/php-fpm.tmp.php'; - @unlink($logfile); - @unlink($srcfile); +require_once "tester.inc"; +FPM\Tester::clean(); ?> diff --git a/sapi/fpm/tests/response.inc b/sapi/fpm/tests/response.inc index 9888ec1b83..2ca9b1e5bc 100644 --- a/sapi/fpm/tests/response.inc +++ b/sapi/fpm/tests/response.inc @@ -124,7 +124,7 @@ class Response */ public function printBody() { - echo $this->getBody(); + echo $this->getBody() . "\n"; } /** |
