Annotation of embedaddon/php/ext/standard/tests/file/stat_variation2-win32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test stat() functions: usage variations - effects of writing to 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 writing to a file on the stats of the file */
! 18:
! 19:
! 20: $file_path = dirname(__FILE__);
! 21: require "$file_path/file.inc";
! 22:
! 23:
! 24: $filename = "$file_path/stat_variation2.tmp";
! 25: $file_handle = fopen($filename, "w"); // temp file
! 26: fclose($file_handle);
! 27:
! 28:
! 29: echo "*** Testing stat(): writing to a file ***\n";
! 30:
! 31: // writing to an empty file
! 32: echo "-- Testing stat() on file after data is written in it --\n";
! 33: $old_stat = stat($filename);
! 34: clearstatcache();
! 35: sleep(2);
! 36: $file_handle = fopen($filename, "w"); // temp file
! 37: fwrite($file_handle, "Hello World");
! 38: fclose($file_handle);
! 39: $new_stat = stat($filename);
! 40:
! 41: // compare self stats
! 42: var_dump( compare_self_stat($old_stat) );
! 43: var_dump( compare_self_stat($new_stat) );
! 44: // compare the stats
! 45: $comp_arr = array(7, 'size');
! 46: var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<"));
! 47: clearstatcache();
! 48:
! 49: echo "\n*** Done ***";
! 50: ?>
! 51:
! 52: --CLEAN--
! 53: <?php
! 54: $file_path = dirname(__FILE__);
! 55: unlink("$file_path/stat_variation2.tmp");
! 56: ?>
! 57: --EXPECTF--
! 58: *** Testing stat(): writing to a file ***
! 59: -- Testing stat() on file after data is written in it --
! 60: bool(true)
! 61: bool(true)
! 62: bool(true)
! 63:
! 64: *** Done ***
! 65:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>