Skip to content

Commit 362e491

Browse files
committed
add test
1 parent e9fe9b0 commit 362e491

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
Multicast error
3+
--EXTENSIONS--
4+
sockets
5+
--SKIPIF--
6+
<?php
7+
if (PHP_OS == 'Darwin') die('skip Not for macOS');
8+
?>
9+
--FILE--
10+
<?php
11+
include __DIR__."/mcast_helpers.php.inc";
12+
$domain = AF_INET;
13+
$level = IPPROTO_IP;
14+
$interface = "lo";
15+
$mcastaddr = '224.0.0.23';
16+
$sblock = "127.0.0.1";
17+
18+
$s = socket_create($domain, SOCK_DGRAM, SOL_UDP);
19+
$b = socket_bind($s, '0.0.0.0', 0);
20+
$iwanttoleavenow = true;
21+
22+
try {
23+
socket_set_option($s, $level, MCAST_LEAVE_GROUP, $iwanttoleavenow);
24+
} catch (\TypeError $e) {
25+
echo $e->getMessage(), PHP_EOL;
26+
}
27+
28+
try {
29+
socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, $iwanttoleavenow);
30+
} catch (\TypeError $e) {
31+
echo $e->getMessage();
32+
}
33+
?>
34+
--EXPECT--
35+
must be of type array when argument #3 ($option) is MCAST_LEAVE_GROUP, true given
36+
must be of type array when argument #3 ($option) is MCAST_LEAVE_SOURCE_GROUP, true given

0 commit comments

Comments
 (0)