]> granicus.if.org Git - php/commitdiff
test to function stream_socket_get_name();
authormarcosptf <marcosptf@yahoo.com.br>
Mon, 14 Dec 2015 16:17:47 +0000 (14:17 -0200)
committerJulien Pauli <jpauli@php.net>
Thu, 24 Dec 2015 09:49:02 +0000 (10:49 +0100)
ext/standard/tests/streams/stream_socket_get_name.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/streams/stream_socket_get_name.phpt b/ext/standard/tests/streams/stream_socket_get_name.phpt
new file mode 100644 (file)
index 0000000..17bf0b7
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+string stream_socket_get_name ( resource $handle , bool $want_peer ) ;
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
+--SKIPIF--
+<?php
+if (phpversion() < "5.3.0") {
+  die('SKIP php version so lower.');
+}
+?>
+--FILE--
+<?php
+$serverUri = "tcp://127.0.0.1:31854";
+$sock = stream_socket_server($serverUri, $errno, $errstr);
+
+var_dump(stream_socket_get_name($sock, false));
+var_dump(stream_socket_get_name($sock, true));
+?>
+--CLEAN--
+<?php
+unset($serverUri);
+unset($sock);
+?>
+--EXPECT--
+string(15) "127.0.0.1:31854"
+bool(false)