diff options
Diffstat (limited to 'ext/standard/tests/streams/stream_set_timeout_error.phpt')
-rw-r--r-- | ext/standard/tests/streams/stream_set_timeout_error.phpt | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 0334b951e0..7dcc645422 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions echo "*** Testing stream_set_timeout() : error conditions ***\n"; -//Test stream_set_timeout with one more than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; - for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); /* Setup socket server */ @@ -26,22 +23,14 @@ $client = fsockopen("tcp://127.0.0.1:$port"); $seconds = 10; $microseconds = 10; -$extra_arg = 10; -var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); - -// Testing stream_set_timeout with one less than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; - -$seconds = 10; -var_dump( stream_set_timeout($client) ); - echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); -var_dump( stream_set_timeout($client, $seconds) ); - -echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; -var_dump( stream_set_timeout($seconds, $seconds) ); +try { + var_dump( stream_set_timeout($client, $seconds) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); @@ -55,25 +44,8 @@ echo "Done"; --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** --- Testing stream_set_timeout() function with more than expected no. of arguments -- - -Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stream_set_timeout() function with less than expected no. of arguments -- - -Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a closed socket -- - -Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - --- Testing stream_set_timeout() function with an invalid stream -- - -Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d -NULL +stream_set_timeout(): supplied resource is not a valid stream resource -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) |