Annotation of embedaddon/php/ext/posix/tests/posix_access.phpt, revision 1.1
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: }
! 16: ?>
! 17: --INI--
! 18: safe_mode = 1
! 19: --FILE--
! 20: <?php
! 21: $filename = dirname(__FILE__) . '/foo.test';
! 22: $fp = fopen($filename,"w");
! 23: fwrite($fp,"foo");
! 24: fclose($fp);
! 25:
! 26: chmod ($filename, 0000);
! 27: var_dump(posix_access($filename, POSIX_F_OK));
! 28:
! 29: chmod ($filename, 0400);
! 30: var_dump(posix_access($filename, POSIX_R_OK));
! 31:
! 32: chmod ($filename, 0600);
! 33: var_dump(posix_access($filename, POSIX_W_OK));
! 34:
! 35: chmod ($filename, 0700);
! 36: var_dump(posix_access($filename, POSIX_X_OK));
! 37: ?>
! 38: ===DONE===
! 39: --CLEAN--
! 40: <?php
! 41: $filename = dirname(__FILE__) . '/foo.test';
! 42: chmod ($filename, 0700);
! 43: unlink($filename);
! 44: ?>
! 45: --EXPECTF--
! 46: Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
! 47: bool(true)
! 48: bool(true)
! 49: bool(true)
! 50: bool(true)
! 51: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>