Annotation of embedaddon/php/ext/standard/tests/file/stat_variation3-win32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test stat() functions: usage variations - effects of creating/deleting the dir/file
! 3: --SKIPIF--
! 4: <?php
! 5: if (substr(PHP_OS, 0, 3) != 'WIN') {
! 6: die('skip.. only for Windows');
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11:
! 12: /*
! 13: * Prototype: array stat ( string $filename );
! 14: * Description: Gives information about a file
! 15: */
! 16:
! 17: /* test the effects of creating & deleting of subdir/file on the stats of dir/file */
! 18:
! 19: $file_path = dirname(__FILE__);
! 20: require "$file_path/file.inc";
! 21:
! 22:
! 23: /* create temp file and directory */
! 24: mkdir("$file_path/stat_variation3/"); // temp dir
! 25:
! 26: echo "*** Testing stat(): with creating & deleting subdir/file ***\n";
! 27:
! 28: // creating and deleting subdir and files in the dir
! 29: echo "-- Testing stat() on dir after subdir and file is created in it --\n";
! 30: $dirname = "$file_path/stat_variation3";
! 31: $old_stat = stat($dirname);
! 32: clearstatcache();
! 33: sleep(2);
! 34: mkdir("$dirname/stat_variation3_subdir");
! 35: $file_handle = fopen("$dirname/stat_variation3a.tmp", "w");
! 36: fclose($file_handle);
! 37: $new_stat = stat($dirname);
! 38:
! 39: // compare self stats
! 40: var_dump( compare_self_stat($old_stat) );
! 41: var_dump( compare_self_stat($new_stat) );
! 42: // compare the stats
! 43: $affected_members = array( 9, 'mtime');
! 44: clearstatcache();
! 45: sleep(2);
! 46: var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
! 47: unlink("$dirname/stat_variation3a.tmp");
! 48: rmdir("$dirname/stat_variation3_subdir");
! 49: clearstatcache();
! 50:
! 51: // comparing stats after the deletion of subdir and file
! 52: echo "-- Testing stat() for comparing stats after the deletion of subdir and file --\n";
! 53: $new_stat1 = stat($dirname);
! 54: // compare self stats
! 55: var_dump( compare_self_stat($new_stat1) );
! 56: // compare the stats
! 57: var_dump(compare_stats($new_stat, $new_stat1, $all_stat_keys, "="));
! 58: clearstatcache();
! 59:
! 60: echo "\n*** Done ***";
! 61: ?>
! 62:
! 63: --CLEAN--
! 64: <?php
! 65: $file_path = dirname(__FILE__);
! 66: rmdir("$file_path/stat_variation3");
! 67: ?>
! 68: --EXPECTF--
! 69:
! 70: *** Testing stat(): with creating & deleting subdir/file ***
! 71: -- Testing stat() on dir after subdir and file is created in it --
! 72: bool(true)
! 73: bool(true)
! 74: bool(true)
! 75: -- Testing stat() for comparing stats after the deletion of subdir and file --
! 76: bool(true)
! 77: bool(true)
! 78:
! 79: *** Done ***
! 80:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>