Annotation of embedaddon/php/ext/standard/tests/file/001-win32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: File type functions
! 3: --CREDITS--
! 4: Dave Kelsey <d_kelsey@uk.ibm.com>
! 5: --SKIPIF--
! 6: <?php
! 7: if (substr(PHP_OS, 0, 3) != 'WIN') {
! 8: die('skip only for Windows');
! 9: }
! 10: ?>
! 11: --FILE--
! 12: <?php
! 13: chdir(dirname(__FILE__));
! 14: @unlink('test.file');
! 15: if (file_exists('test.file')) {
! 16: echo "test.file exists\n";
! 17: } else {
! 18: echo "test.file does not exist\n";
! 19: }
! 20: fclose (fopen('test.file', 'w'));
! 21: chmod ('test.file', 0744);
! 22: if (file_exists('test.file')) {
! 23: echo "test.file exists\n";
! 24: } else {
! 25: echo "test.file does not exist\n";
! 26: }
! 27: if (is_link('test.file')) {
! 28: echo "test.file is a symlink\n";
! 29: } else {
! 30: echo "test.file is not a symlink\n";
! 31: }
! 32: if (file_exists('test.file')) {
! 33: echo "test.file exists\n";
! 34: } else {
! 35: echo "test.file does not exist\n";
! 36: }
! 37: $s = stat ('test.file');
! 38: $ls = lstat ('test.file');
! 39: for ($i = 0; $i <= 12; $i++) {
! 40: if ($ls[$i] != $s[$i]) {
! 41: echo "test.file lstat and stat differ at element $i\n";
! 42: }
! 43: }
! 44: echo "test.file is " . filetype('test.file') . "\n";
! 45: printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
! 46: echo "test.file size is " . filesize('test.file') . "\n";
! 47: if (is_writeable('test.file')) {
! 48: echo "test.file is writeable\n";
! 49: } else {
! 50: echo "test.file is not writeable\n";
! 51: }
! 52: if (is_readable('test.file')) {
! 53: echo "test.file is readable\n";
! 54: } else {
! 55: echo "test.file is not readable\n";
! 56: }
! 57: if (is_file('test.file')) {
! 58: echo "test.file is a regular file\n";
! 59: } else {
! 60: echo "test.file is not a regular file\n";
! 61: }
! 62: if (is_dir('../file')) {
! 63: echo "../file is a directory\n";
! 64: } else {
! 65: echo "../file is not a directory\n";
! 66: }
! 67: if (is_dir('test.file')) {
! 68: echo "test.file is a directory\n";
! 69: } else {
! 70: echo "test.file is not a directory\n";
! 71: }
! 72: unlink('test.file');
! 73: if (file_exists('test.file')) {
! 74: echo "test.file exists (cached)\n";
! 75: } else {
! 76: echo "test.file does not exist\n";
! 77: }
! 78: clearstatcache();
! 79: if (file_exists('test.file')) {
! 80: echo "test.file exists\n";
! 81: } else {
! 82: echo "test.file does not exist\n";
! 83: }
! 84: ?>
! 85: --EXPECT--
! 86: test.file does not exist
! 87: test.file exists
! 88: test.file is not a symlink
! 89: test.file exists
! 90: test.file is file
! 91: test.file permissions are 0666
! 92: test.file size is 0
! 93: test.file is writeable
! 94: test.file is readable
! 95: test.file is a regular file
! 96: ../file is a directory
! 97: test.file is not a directory
! 98: test.file does not exist
! 99: test.file does not exist
! 100:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>