Annotation of embedaddon/php/ext/posix/tests/posix_access.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test posix_access() function test
3: --DESCRIPTION--
4: checks for existence, read-access, write-access, execute-access
5: --CREDITS--
6: Moritz Neuhaeuser, info@xcompile.net
7: PHP Testfest Berlin 2009-05-10
8: --SKIPIF--
9: <?php
10: if (!extension_loaded('posix')) {
11: die('SKIP The posix extension is not loaded.');
12: }
13: if (posix_geteuid() == 0) {
14: die('SKIP Cannot run test as root.');
15: }
1.1.1.2 ! misho 16: if (PHP_VERSION_ID < 503099) {
! 17: die('SKIP Safe mode is no longer available.');
! 18: }
1.1 misho 19: ?>
20: --FILE--
21: <?php
22: $filename = dirname(__FILE__) . '/foo.test';
23: $fp = fopen($filename,"w");
24: fwrite($fp,"foo");
25: fclose($fp);
26:
27: chmod ($filename, 0000);
28: var_dump(posix_access($filename, POSIX_F_OK));
29:
30: chmod ($filename, 0400);
31: var_dump(posix_access($filename, POSIX_R_OK));
32:
33: chmod ($filename, 0600);
34: var_dump(posix_access($filename, POSIX_W_OK));
35:
36: chmod ($filename, 0700);
37: var_dump(posix_access($filename, POSIX_X_OK));
38: ?>
39: ===DONE===
40: --CLEAN--
41: <?php
42: $filename = dirname(__FILE__) . '/foo.test';
43: chmod ($filename, 0700);
44: unlink($filename);
45: ?>
46: --EXPECTF--
47: Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
48: bool(true)
49: bool(true)
50: bool(true)
51: bool(true)
52: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>