Skip to content

Commit 1fd7e9a

Browse files
author
Payden Sutherland
committed
Adding test for xzopen with invalid mode
1 parent 3d6cdb4 commit 1fd7e9a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/xzopen_error.phpt

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
Test xzopen() function : error conditions
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("xz")) {
6+
print "skip - XZ extension not loaded";
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
/* Prototype : resource xzopen(string filename, string mode)
12+
* Description: Open a xz file and return a xz file pointer
13+
* Source code: ext/xz/xz.c
14+
* Alias to functions:
15+
*/
16+
17+
echo "*** Testing xzopen() : error conditions ***\n";
18+
19+
20+
//Test gzopen with one more than the expected number of arguments
21+
echo "\n-- Testing xzopen() function with invalid mode --\n";
22+
$filename = 'string_val';
23+
$mode = 'a';
24+
var_dump( xzopen($filename, $mode) );
25+
26+
?>
27+
===DONE===
28+
--EXPECTF--
29+
*** Testing xzopen() : error conditions ***
30+
31+
-- Testing xzopen() function with invalid mode --
32+
33+
Warning: xzopen(): Can only open in read (r) or write (w) mode.
34+
bool(false)
35+
===DONE===

0 commit comments

Comments
 (0)