Annotation of embedaddon/php/ext/standard/tests/file/chmod_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
11: echo "*** Testing chmod() : error conditions ***\n";
12:
13:
14: //Test chmod with one more than the expected number of arguments
15: echo "\n-- Testing chmod() function with more than expected no. of arguments --\n";
16: $filename = 'string_val';
17: $mode = 10;
18: $extra_arg = 10;
19: var_dump( chmod($filename, $mode, $extra_arg) );
20:
21: // Testing chmod with one less than the expected number of arguments
22: echo "\n-- Testing chmod() function with less than expected no. of arguments --\n";
23: $filename = 'string_val';
24: var_dump( chmod($filename) );
25:
26: // testing chmod with a non-existing file
27: $filename = "___nonExisitingFile___";
28: var_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:
37: Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
38: NULL
39:
40: -- Testing chmod() function with less than expected no. of arguments --
41:
42: Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
43: NULL
44:
45: Warning: chmod(): No such file or directory in %s on line %d
46: bool(false)
47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>