Skip to content

Commit dd622f9

Browse files
committed
Port FPM test 023 and 024 to the new FPM testing
1 parent bc58ba7 commit dd622f9

File tree

4 files changed

+100
-139
lines changed

4 files changed

+100
-139
lines changed

sapi/fpm/tests/023.phpt

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

sapi/fpm/tests/024-bug72212.phpt

Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
--TEST--
2+
FPM: bug75212 - php_value acts like php_admin_value
3+
--SKIPIF--
4+
<?php include "skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
8+
require_once "tester.inc";
9+
10+
$cfg = <<<EOT
11+
[global]
12+
error_log = {{FILE:LOG}}
13+
[unconfined]
14+
listen = {{ADDR}}
15+
pm = dynamic
16+
pm.max_children = 5
17+
pm.start_servers = 1
18+
pm.min_spare_servers = 1
19+
pm.max_spare_servers = 3
20+
php_admin_value[memory_limit]=32M
21+
php_value[date.timezone]=Europe/London
22+
EOT;
23+
24+
$code = <<<EOT
25+
<?php
26+
echo "Test Start\n";
27+
var_dump(ini_get('memory_limit'), ini_get('date.timezone'));
28+
echo "Test End\n";
29+
EOT;
30+
31+
$ini = <<<EOT
32+
memory_limit=64M
33+
date.timezone=Europe/Paris
34+
EOT;
35+
36+
$tester = new FPM\Tester($cfg, $code);
37+
$tester->setUserIni($ini);
38+
$tester->start();
39+
$tester->expectLogStartNotices();
40+
$tester->request()->expectBody([
41+
'Test Start',
42+
'string(3) "32M"',
43+
'string(12) "Europe/Paris"',
44+
'Test End'
45+
]);
46+
$tester->terminate();
47+
$tester->close();
48+
49+
?>
50+
Done
51+
--EXPECT--
52+
Done
53+
--CLEAN--
54+
<?php
55+
require_once "tester.inc";
56+
FPM\Tester::clean();
57+
?>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
FPM: Socket port connection falls back to IPv4
3+
--SKIPIF--
4+
<?php
5+
include "skipif.inc";
6+
FPM\Tester::skipIfIPv6IsNotSupported();
7+
?>
8+
--FILE--
9+
<?php
10+
11+
require_once "tester.inc";
12+
13+
$cfg = <<<EOT
14+
[global]
15+
error_log = {{FILE:LOG}}
16+
[unconfined]
17+
listen = {{PORT}}
18+
pm = dynamic
19+
pm.max_children = 5
20+
pm.start_servers = 2
21+
pm.min_spare_servers = 1
22+
pm.max_spare_servers = 3
23+
EOT;
24+
25+
$tester = new FPM\Tester($cfg);
26+
$port = $tester->getPort();
27+
// Occupy our port and let things fail
28+
$busy = stream_socket_server("tcp://[::]:$port");
29+
$tester->start();
30+
$tester->expectLogNotice('Failed implicitly binding to ::, retrying with 0.0.0.0');
31+
$tester->expectLogError("unable to bind listening socket for address '$port': " .
32+
'Address already in use \(\d+\)');
33+
$tester->expectLogError('FPM initialization failed');
34+
$tester->close(true);
35+
?>
36+
Done
37+
--EXPECT--
38+
Done
39+
--CLEAN--
40+
<?php
41+
require_once "tester.inc";
42+
FPM\Tester::clean();
43+
?>

0 commit comments

Comments
 (0)