Annotation of embedaddon/php/sapi/cli/tests/022.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: STDIN/OUT/ERR stream type
! 3: --SKIPIF--
! 4: <?php
! 5: if (!getenv("TEST_PHP_EXECUTABLE")) die("skip TEST_PHP_EXECUTABLE not set");
! 6: if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test");
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: $php = getenv("TEST_PHP_EXECUTABLE");
! 11: $socket_file = tempnam(sys_get_temp_dir(), pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock');
! 12: $test_file = dirname(__FILE__) . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc';
! 13: if (file_exists($socket_file)) {
! 14: unlink($socket_file);
! 15: }
! 16: $socket = stream_socket_server('unix://' . $socket_file);
! 17: var_dump($socket);
! 18: if (!$socket) {
! 19: exit(1);
! 20: }
! 21: $desc = array(
! 22: 0 => $socket,
! 23: 1 => STDOUT,
! 24: 2 => STDERR,
! 25: );
! 26: $pipes = array();
! 27: $proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes);
! 28: var_dump($proc);
! 29: if (!$proc) {
! 30: exit(1);
! 31: }
! 32:
! 33: $client_socket = stream_socket_client('unix://' . $socket_file);
! 34: var_dump($client_socket);
! 35: echo stream_get_contents($client_socket);
! 36: fclose($client_socket);
! 37:
! 38: proc_terminate($proc);
! 39: proc_close($proc);
! 40: unlink($socket_file);
! 41: ?>
! 42: --EXPECTF--
! 43: resource(%d) of type (stream)
! 44: resource(%d) of type (process)
! 45: resource(%d) of type (stream)
! 46: resource(%d) of type (stream)
! 47: resource(%d) of type (stream)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>