mirror of
https://github.com/php/php-src.git
synced 2024-12-04 15:23:44 +08:00
Add test socket_setopt() basic functionality
Rodrigo Prado de Jesus royopa@gmail.com User Group: PHPSP #PHPTestFestBrasil --------------------------------------------------------------- The function was not coveraged yet sockets Function socket_setopt no http://gcov.php.net/viewer.php?version=PHP_HEAD&func=tested_functions
This commit is contained in:
parent
e1cc714445
commit
b86d7738fb
31
ext/sockets/tests/socket_setopt_basic.phpt
Normal file
31
ext/sockets/tests/socket_setopt_basic.phpt
Normal file
@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test socket_setopt() basic functionality
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
User Group: PHPSP #PHPTestFestBrasil
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sockets')) {
|
||||
die('skip. Sockets extension is not available.');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
if (!$socket) {
|
||||
die('Unable to create AF_INET socket [socket]');
|
||||
}
|
||||
socket_set_block($socket);
|
||||
|
||||
//set/get comparison
|
||||
$options = array("sec" => 1, "usec" => 0);
|
||||
$retval_1 = socket_setopt( $socket, SOL_SOCKET, SO_SNDTIMEO, $options);
|
||||
$retval_2 = socket_getopt( $socket, SOL_SOCKET, SO_SNDTIMEO);
|
||||
|
||||
var_dump($retval_1);
|
||||
var_dump($retval_2 === $options);
|
||||
socket_close($socket);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
Loading…
Reference in New Issue
Block a user