1
1
--TEST--
2
- FPM: Test fpm_get_status function
2
+ FPM: Function fpm_get_status basic test
3
3
--SKIPIF--
4
4
<?php include "skipif.inc " ; ?>
5
5
--FILE--
6
6
<?php
7
7
8
- include "include.inc " ;
9
-
10
- $ logfile = __DIR__ .'/php-fpm.log.tmp ' ;
11
- $ srcfile = __DIR__ .'/php-fpm.tmp.php ' ;
12
- $ port = 9000 +PHP_INT_SIZE ;
8
+ require_once "tester.inc " ;
13
9
14
10
$ cfg = <<<EOT
15
11
[global]
16
- error_log = $ logfile
12
+ error_log = {{FILE:LOG}}
17
13
[unconfined]
18
- listen = 127.0.0.1: $ port
14
+ listen = {{ADDR}}
19
15
pm = dynamic
20
16
pm.max_children = 5
21
17
pm.start_servers = 1
@@ -29,29 +25,19 @@ echo "Test Start\n";
29
25
var_dump(fpm_get_status());
30
26
echo "Test End \n";
31
27
EOT ;
32
- file_put_contents ($ srcfile , $ code );
33
28
34
- $ fpm = run_fpm ($ cfg , $ tail );
35
- if (is_resource ($ fpm )) {
36
- fpm_display_log ($ tail , 2 );
37
- try {
38
- $ req = run_request ('127.0.0.1 ' , $ port , $ srcfile );
39
- echo strstr ($ req , "Test Start " );
40
- echo "Request ok \n" ;
41
- } catch (Exception $ e ) {
42
- echo "Request error \n" ;
43
- }
44
- proc_terminate ($ fpm );
45
- fpm_display_log ($ tail , -1 );
46
- fclose ($ tail );
47
- proc_close ($ fpm );
48
- }
29
+ $ headers = [];
30
+ $ tester = new FPM \Tester ($ cfg , $ code );
31
+ $ tester ->start ();
32
+ $ tester ->expectLogStartNotices ();
33
+ $ tester ->request ()->printBody ();
34
+ $ tester ->terminate ();
35
+ $ tester ->expectLogTerminatingNotices ();
36
+ $ tester ->close ();
49
37
50
38
?>
51
39
Done
52
40
--EXPECTF--
53
- [%s] NOTICE: fpm is running, pid %d
54
- [%s] NOTICE: ready to handle connections
55
41
Test Start
56
42
array(15) {
57
43
["pool"]=>
@@ -118,15 +104,9 @@ array(15) {
118
104
}
119
105
}
120
106
Test End
121
-
122
- Request ok
123
- [%s] NOTICE: Terminating ...
124
- [%s] NOTICE: exiting, bye-bye!
125
107
Done
126
108
--CLEAN--
127
109
<?php
128
- $ logfile = __DIR__ .'/php-fpm.log.tmp ' ;
129
- $ srcfile = __DIR__ .'/php-fpm.tmp.php ' ;
130
- @unlink ($ logfile );
131
- @unlink ($ srcfile );
110
+ require_once "tester.inc " ;
111
+ FPM \Tester::clean ();
132
112
?>
0 commit comments