From 3dabbbd5325c9fad9582cd44b1da68dece78eaa0 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 21 Jun 2018 16:42:32 +0200 Subject: no reason for different naming --- test/it_url_server.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/it_url_server.php (limited to 'test/it_url_server.php') diff --git a/test/it_url_server.php b/test/it_url_server.php new file mode 100644 index 0000000..3805a79 --- /dev/null +++ b/test/it_url_server.php @@ -0,0 +1,32 @@ + fopen('/dev/null', 'r'), 1 => fopen('/dev/null', 'w'), 2 => array('pipe', 'w')), + $pipes +); +register_shutdown_function( + function ($server) { + proc_terminate($server); + }, + $server +); + +usleep(100000); +stream_set_blocking($pipes[2], 0); + +function server_output() { + $result = array(); + while (($result[] = trim(fgets($GLOBALS['pipes'][2])))) {}; + return array_filter($result); +} + +function handle_server($args) { + $res = true; + foreach ((array)$args as $arg) + $res = $res && $arg; + $output = server_output(); + if (!$res) + diag($output); + else + return $output; +} -- cgit v1.2.3