summaryrefslogtreecommitdiff
path: root/ext/sockets/tests/socket_import_stream-1.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sockets/tests/socket_import_stream-1.phpt')
-rw-r--r--ext/sockets/tests/socket_import_stream-1.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/sockets/tests/socket_import_stream-1.phpt b/ext/sockets/tests/socket_import_stream-1.phpt
new file mode 100644
index 0000000..222fca5
--- /dev/null
+++ b/ext/sockets/tests/socket_import_stream-1.phpt
@@ -0,0 +1,26 @@
+--TEST--
+socket_import_stream: Basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('SKIP sockets extension not available.');
+}
+
+--FILE--
+<?php
+
+$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
+$s = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
+
+$s0 = reset($s);
+$s1 = next($s);
+
+$sock = socket_import_stream($s0);
+var_dump($sock);
+socket_write($sock, "test message");
+socket_close($sock);
+
+var_dump(stream_get_contents($s1));
+--EXPECTF--
+resource(%d) of type (Socket)
+string(12) "test message"