Annotation of embedaddon/php/ext/standard/tests/file/lstat_stat_variation7.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test lstat() and stat() functions: usage variations - writing data into file
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (substr(PHP_OS, 0, 3) == 'WIN') {
        !             6:     die('skip.. Not valid for Windows');
        !             7: }
        !             8: ?>
        !             9: --FILE--
        !            10: <?php
        !            11: /* Prototype: array lstat ( string $filename );
        !            12:    Description: Gives information about a file or symbolic link
        !            13: 
        !            14:    Prototype: array stat ( string $filename );
        !            15:    Description: Gives information about a file
        !            16: */
        !            17: 
        !            18: $file_path = dirname(__FILE__);
        !            19: require "$file_path/file.inc";
        !            20: 
        !            21: /* test the effects on stats with writing data into a  file */
        !            22: 
        !            23: $file_name = "$file_path/lstat_stat_variation7.tmp";
        !            24: $fp = fopen($file_name, "w");  // temp file
        !            25: fclose($fp);
        !            26: 
        !            27: // writing to an empty file
        !            28: echo "*** Testing stat() on file after data is written in it ***\n";
        !            29: $fh = fopen($file_name,"w");
        !            30: $old_stat = stat($file_name);
        !            31: clearstatcache();
        !            32: fwrite($fh, (binary)"Hello World");
        !            33: $new_stat = stat($file_name);
        !            34: 
        !            35: // compare self stats
        !            36: var_dump( compare_self_stat($old_stat) );
        !            37: var_dump( compare_self_stat($new_stat) );
        !            38: // compare the stats
        !            39: $comp_arr = array(7, 12, 'size', 'blocks');
        !            40: var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<"));
        !            41: clearstatcache();
        !            42: 
        !            43: echo "\n--- Done ---";
        !            44: ?>
        !            45: 
        !            46: --CLEAN--
        !            47: <?php
        !            48: $file_path = dirname(__FILE__);
        !            49: unlink("$file_path/lstat_stat_variation7.tmp");
        !            50: ?>
        !            51: --EXPECTF--
        !            52: *** Testing stat() on file after data is written in it ***
        !            53: bool(true)
        !            54: bool(true)
        !            55: bool(true)
        !            56: 
        !            57: --- Done ---

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>