summaryrefslogtreecommitdiff
path: root/ext/standard/tests/streams/stream_socket_sendto.phpt
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2017-01-06 07:27:31 +0000
committerJoe Watkins <krakjoe@php.net>2017-01-06 07:27:31 +0000
commit3a79f35fdc2c6d95868ecf258b107d53b75781d9 (patch)
tree37657bc6238e1f007064df9168f33d864fb6c9a7 /ext/standard/tests/streams/stream_socket_sendto.phpt
parentff6b309c6f4c26ffedd5fc9e4cd021b7300617a3 (diff)
downloadphp-git-3a79f35fdc2c6d95868ecf258b107d53b75781d9.tar.gz
add stream_socket_sendto test from PR #1804
Diffstat (limited to 'ext/standard/tests/streams/stream_socket_sendto.phpt')
-rw-r--r--ext/standard/tests/streams/stream_socket_sendto.phpt58
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/stream_socket_sendto.phpt b/ext/standard/tests/streams/stream_socket_sendto.phpt
new file mode 100644
index 0000000000..62d9f6ef80
--- /dev/null
+++ b/ext/standard/tests/streams/stream_socket_sendto.phpt
@@ -0,0 +1,58 @@
+--TEST--
+int stream_socket_sendto ( resource $socket , string $data [, int $flags = 0 [, string $address ]] );
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
+--SKIPIF--
+<?php
+if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
+?>
+--FILE--
+<?php
+$serverUri = "tcp://127.0.0.1:31854";
+$serverUrl = "http://php.net";
+$stringSocket = "out of band data.";
+$stringFWrite = "normal data to transmit";
+$sock = stream_socket_server($serverUri, $errno, $errstr);
+
+if (is_resource($sock)) {
+ fwrite($sock, $stringFWrite);
+ var_dump(stream_socket_sendto());
+ var_dump(stream_socket_sendto($sock));
+ var_dump(stream_socket_sendto($sock, $stringSocket));
+ var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB));
+ var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri));
+ var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUrl));
+} else {
+ die("Test stream_socket_enable_crypto has failed; Unable to connect: {$errstr} ({$errno})");
+}
+?>
+--EXPECTF--
+Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %i
+
+Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %i
+bool(%s)
+
+Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %i
+bool(%s)
+
+Warning: stream_socket_sendto(): Broken pipe
+ in %s on line %i
+int(%i)
+
+Warning: stream_socket_sendto(): Broken pipe
+ in %s on line %i
+int(%i)
+
+Warning: stream_socket_sendto(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i
+
+Warning: stream_socket_sendto(): Failed to resolve %s: php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i
+
+Warning: stream_socket_sendto(): Failed to parse %s into a valid network address in %s on line %i
+bool(%s)
+
+Warning: stream_socket_sendto(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i
+
+Warning: stream_socket_sendto(): Failed to resolve %s: php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i
+
+Warning: stream_socket_sendto(): Failed to parse %s into a valid network address in %s on line %i
+bool(%s)