Skip to content

Commit 1008c92

Browse files
committed
Stream test fixes
1 parent 7f7dbbb commit 1008c92

8 files changed

+10
-108
lines changed

ext/standard/tests/streams/bug46426.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0);
2121
echo "\n";
2222
echo stream_get_contents($tmp, -1);
2323

24-
@unlink($tmp);
25-
2624
?>
2725
--EXPECT--
2826
23

ext/standard/tests/streams/stream_get_contents_001.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n";
1212
echo stream_get_contents($tmp, 2, 3), "--\n";
1313
echo stream_get_contents($tmp, 2, -1), "--\n";
1414

15-
@unlink($tmp);
16-
1715
?>
1816
--EXPECT--
1917
--

ext/standard/tests/streams/stream_get_meta_data_file_error.phpt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,6 @@ Test stream_get_meta_data() function : error conditions
1010

1111
echo "*** Testing stream_get_meta_data() : error conditions ***\n";
1212

13-
// Zero arguments
14-
echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
15-
var_dump( stream_get_meta_data() );
16-
17-
//Test stream_get_meta_data with one more than the expected number of arguments
18-
echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
19-
20-
$fp = null;
21-
$extra_arg = 10;
22-
var_dump( stream_get_meta_data($fp, $extra_arg) );
23-
24-
echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
25-
$fp = null;
26-
var_dump(stream_get_meta_data($fp));
27-
2813
echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
2914
$fp = fopen(__FILE__, 'r');
3015
fclose($fp);
@@ -35,21 +20,6 @@ echo "Done";
3520
--EXPECTF--
3621
*** Testing stream_get_meta_data() : error conditions ***
3722

38-
-- Testing stream_get_meta_data() function with Zero arguments --
39-
40-
Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d
41-
NULL
42-
43-
-- Testing stream_get_meta_data() function with more than expected no. of arguments --
44-
45-
Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d
46-
NULL
47-
48-
-- Testing stream_get_meta_data() function with invalid stream resource --
49-
50-
Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d
51-
NULL
52-
5323
-- Testing stream_get_meta_data() function with closed stream resource --
5424

5525
Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d

ext/standard/tests/streams/stream_resolve_include_path.phpt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ mkdir($include_path_nested);
1414
file_put_contents($include_path_file, 'include_path');
1515
file_put_contents($include_path_nested_file, 'include_path');
1616

17-
var_dump(stream_resolve_include_path());
18-
1917
set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
2018
var_dump(stream_resolve_include_path('file-does-not-exist'));
2119

@@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file'));
2422
set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
2523
var_dump(stream_resolve_include_path('file'));
2624

25+
?>
26+
--CLEAN--
27+
<?php
28+
$include_path = __DIR__ . '/test_path';
29+
$include_path_nested = $include_path . '/nested';
30+
$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
31+
$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';
32+
2733
unlink($include_path_nested_file);
2834
rmdir($include_path_nested);
2935
unlink($include_path_file);
3036
rmdir($include_path);
37+
?>
3138
--EXPECTF--
32-
Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d
33-
NULL
3439
bool(false)
3540
string(%d) "%stest_path%sfile"
3641
string(%d) "%stest_path%snested%sfile"

ext/standard/tests/streams/stream_set_chunk_size.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250))));
5151
echo "\nerror conditions\n";
5252
var_dump(stream_set_chunk_size($f, 0));
5353
var_dump(stream_set_chunk_size($f, -1));
54-
var_dump(stream_set_chunk_size($f, array()));
5554
--EXPECTF--
5655
bool(true)
5756
should return previous chunk size (8192)
@@ -87,6 +86,3 @@ bool(false)
8786

8887
Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d
8988
bool(false)
90-
91-
Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d
92-
bool(false)

ext/standard/tests/streams/stream_set_timeout_error.phpt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions
1010

1111
echo "*** Testing stream_set_timeout() : error conditions ***\n";
1212

13-
//Test stream_set_timeout with one more than the expected number of arguments
14-
echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n";
15-
1613
for ($i=0; $i<100; $i++) {
1714
$port = rand(10000, 65000);
1815
/* Setup socket server */
@@ -26,23 +23,11 @@ $client = fsockopen("tcp://127.0.0.1:$port");
2623

2724
$seconds = 10;
2825
$microseconds = 10;
29-
$extra_arg = 10;
30-
var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) );
31-
32-
// Testing stream_set_timeout with one less than the expected number of arguments
33-
echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n";
34-
35-
$seconds = 10;
36-
var_dump( stream_set_timeout($client) );
37-
3826

3927
echo "\n-- Testing stream_set_timeout() function with a closed socket --\n";
4028
fclose($client);
4129
var_dump( stream_set_timeout($client, $seconds) );
4230

43-
echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n";
44-
var_dump( stream_set_timeout($seconds, $seconds) );
45-
4631
echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n";
4732
$filestream = fopen(__FILE__, "r");
4833
var_dump( stream_set_timeout($filestream, $seconds) );
@@ -55,26 +40,11 @@ echo "Done";
5540
--EXPECTF--
5641
*** Testing stream_set_timeout() : error conditions ***
5742

58-
-- Testing stream_set_timeout() function with more than expected no. of arguments --
59-
60-
Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d
61-
NULL
62-
63-
-- Testing stream_set_timeout() function with less than expected no. of arguments --
64-
65-
Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d
66-
NULL
67-
6843
-- Testing stream_set_timeout() function with a closed socket --
6944

7045
Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d
7146
bool(false)
7247

73-
-- Testing stream_set_timeout() function with an invalid stream --
74-
75-
Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d
76-
NULL
77-
7848
-- Testing stream_set_timeout() function with a stream that does not support timeouts --
7949
bool(false)
8050
Done

ext/standard/tests/streams/stream_socket_sendto.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ $sock = stream_socket_server($serverUri, $errno, $errstr);
1616

1717
if (is_resource($sock)) {
1818
fwrite($sock, $stringFWrite);
19-
var_dump(stream_socket_sendto());
20-
var_dump(stream_socket_sendto($sock));
2119
var_dump(stream_socket_sendto($sock, $stringSocket));
2220
var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB));
2321
var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri));
@@ -29,12 +27,6 @@ if (is_resource($sock)) {
2927
--EXPECTF--
3028
Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %d
3129

32-
Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d
33-
bool(%s)
34-
35-
Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d
36-
bool(%s)
37-
3830
Warning: stream_socket_sendto(): Broken pipe
3931
in %s on line %d
4032
int(%i)

ext/standard/tests/time/strptime_error.phpt

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,15 @@ date_default_timezone_set("Europe/London");
1919

2020
echo "*** Testing strptime() : error conditions ***\n";
2121

22-
echo "\n-- Testing strptime() function with Zero arguments --\n";
23-
var_dump( strptime() );
24-
25-
echo "\n-- Testing strptime() function with less than expected no. of arguments --\n";
26-
$format = '%b %d %Y %H:%M:%S';
27-
$timestamp = mktime(8, 8, 8, 8, 8, 2008);
28-
$date = strftime($format, $timestamp);
29-
var_dump( strptime($date) );
30-
31-
echo "\n-- Testing strptime() function with more than expected no. of arguments --\n";
32-
$extra_arg = 10;
33-
var_dump( strptime($date, $format, $extra_arg) );
34-
3522
echo "\n-- Testing strptime() function on failure --\n";
23+
$format = '%b %d %Y %H:%M:%S';
3624
var_dump( strptime('foo', $format) );
3725

3826
?>
3927
===DONE===
4028
--EXPECTF--
4129
*** Testing strptime() : error conditions ***
4230

43-
-- Testing strptime() function with Zero arguments --
44-
45-
Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d
46-
NULL
47-
48-
-- Testing strptime() function with less than expected no. of arguments --
49-
50-
Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d
51-
NULL
52-
53-
-- Testing strptime() function with more than expected no. of arguments --
54-
55-
Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
56-
NULL
57-
5831
-- Testing strptime() function on failure --
5932
bool(false)
6033
===DONE===

0 commit comments

Comments
 (0)