summaryrefslogtreecommitdiff
path: root/ext/sockets/tests
diff options
context:
space:
mode:
authorJulien Pauli <jpauli@php.net>2015-12-24 13:33:22 +0100
committerJulien Pauli <jpauli@php.net>2015-12-24 14:08:44 +0100
commitd73d9fecf6c7a4cf2a7443f1a3833c8fb6e30ea1 (patch)
treefd610d94948380cf77fe7065696886aa4b1a5f42 /ext/sockets/tests
parent7f31a88bb8493eaa4968db6169b939342f0ba0f7 (diff)
downloadphp-git-d73d9fecf6c7a4cf2a7443f1a3833c8fb6e30ea1.tar.gz
Fixed and improved tests
Diffstat (limited to 'ext/sockets/tests')
-rw-r--r--ext/sockets/tests/socket_clear_error.phpt28
-rw-r--r--ext/sockets/tests/socket_getopt.phpt5
2 files changed, 30 insertions, 3 deletions
diff --git a/ext/sockets/tests/socket_clear_error.phpt b/ext/sockets/tests/socket_clear_error.phpt
new file mode 100644
index 0000000000..af9acaa9bf
--- /dev/null
+++ b/ext/sockets/tests/socket_clear_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+void socket_clear_error ([ resource $socket ] ) ;
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('SKIP sockets extension not available.');
+}
+?>
+--FILE--
+<?php
+$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+$socketConn = socket_connect($socket, "127.0.0.1", 21248);
+var_dump(socket_last_error($socket));
+socket_clear_error($socket);
+var_dump(socket_last_error($socket));
+?>
+--CLEAN--
+<?php
+socket_close($socket);
+unset($socket);
+unset($socketConn);
+?>
+--EXPECTF--
+Warning: socket_connect(): unable to connect [%d]: Connection refused in %s on line %d
+int(%d)
+int(%d)
diff --git a/ext/sockets/tests/socket_getopt.phpt b/ext/sockets/tests/socket_getopt.phpt
index 639328cc62..12c0aeb888 100644
--- a/ext/sockets/tests/socket_getopt.phpt
+++ b/ext/sockets/tests/socket_getopt.phpt
@@ -3,12 +3,11 @@ mixed socket_getopt( resource $socket , int $level , int $optname ) ;
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
--SKIPIF--
+<?php
if (!extension_loaded('sockets')) {
die('skip sockets extension not available.');
}
-if (socket_set_option($s, $level, IP_MULTICAST_IF, 1) === false) {
- die("skip interface 1 either doesn't exist or has no ipv4 address");
-}
+?>
--FILE--
<?php
$domain = AF_INET;