1--TEST--
2Test chmod() function : error conditions
3--FILE--
4<?php
5/* Prototype  : bool chmod(string filename, int mode)
6 * Description: Change file mode
7 * Source code: ext/standard/filestat.c
8 * Alias to functions:
9 */
10
11echo "*** Testing chmod() : error conditions ***\n";
12
13
14//Test chmod with one more than the expected number of arguments
15echo "\n-- Testing chmod() function with more than expected no. of arguments --\n";
16$filename = 'string_val';
17$mode = 10;
18$extra_arg = 10;
19var_dump( chmod($filename, $mode, $extra_arg) );
20
21// Testing chmod with one less than the expected number of arguments
22echo "\n-- Testing chmod() function with less than expected no. of arguments --\n";
23$filename = 'string_val';
24var_dump( chmod($filename) );
25
26// testing chmod with a non-existing file
27$filename = "___nonExisitingFile___";
28var_dump(chmod($filename, 0777));
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing chmod() : error conditions ***
34
35-- Testing chmod() function with more than expected no. of arguments --
36
37Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
38NULL
39
40-- Testing chmod() function with less than expected no. of arguments --
41
42Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
43NULL
44
45Warning: chmod(): No such file or directory in %s on line %d
46bool(false)
47===DONE===
48