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

1.1     ! misho       1: --TEST--
        !             2: Test fileatime(), filemtime(), filectime() & touch() functions : usage variation
        !             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 Non Windows Systems');
        !             9: }
        !            10: ?>
        !            11: --FILE--
        !            12: <?php
        !            13: /*
        !            14:    Prototype: int fileatime ( string $filename );
        !            15:    Description: Returns the time the file was last accessed, or FALSE 
        !            16:      in case of an error. The time is returned as a Unix timestamp.
        !            17: 
        !            18:    Prototype: int filemtime ( string $filename );
        !            19:    Description: Returns the time the file was last modified, or FALSE 
        !            20:      in case of an error. 
        !            21: 
        !            22:    Prototype: int filectime ( string $filename );
        !            23:    Description: Returns the time the file was last changed, or FALSE
        !            24:      in case of an error. The time is returned as a Unix timestamp.
        !            25: 
        !            26:    Prototype: bool touch ( string $filename [, int $time [, int $atime]] );
        !            27:    Description: Attempts to set the access and modification times of the file
        !            28:      named in the filename parameter to the value given in time.
        !            29: */
        !            30: 
        !            31: /*
        !            32:    Prototype: void stat_fn(string $filename);
        !            33:    Description: Prints access, modification and change times of a file
        !            34: */
        !            35: function stat_fn( $filename ) {
        !            36:   echo "\n-- File '$filename' --\n";
        !            37:   echo "-- File access time is => "; 
        !            38:   echo fileatime($filename)."\n";
        !            39:   clearstatcache();
        !            40:   echo "-- File modification time is => "; 
        !            41:   echo filemtime($filename)."\n";
        !            42:   clearstatcache();
        !            43:   echo "-- inode change time is => "; 
        !            44:   echo filectime($filename)."\n";
        !            45:   clearstatcache();
        !            46:   
        !            47: 
        !            48: }
        !            49: 
        !            50: echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
        !            51: echo "\n*** testing touch ***\n";
        !            52: $a = touch(NULL);
        !            53: $b = touch(false);
        !            54: $c = touch('');
        !            55: $d = touch(' ');
        !            56: $e = touch('|');
        !            57: 
        !            58: var_dump($a);
        !            59: var_dump($b);
        !            60: var_dump($c);
        !            61: var_dump($d);
        !            62: var_dump($e);
        !            63: 
        !            64: echo "\n*** testing file info ***";
        !            65: stat_fn(NULL);
        !            66: stat_fn(false);
        !            67: stat_fn('');
        !            68: stat_fn(' ');
        !            69: stat_fn('|');
        !            70: 
        !            71: var_dump(unlink(' '));
        !            72: var_dump(unlink('|'));
        !            73: 
        !            74: echo "Done";
        !            75: ?>
        !            76: --EXPECTF--
        !            77: *** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
        !            78: 
        !            79: *** testing touch ***
        !            80: 
        !            81: Warning: touch(): Unable to create file  because No such file or directory in %s on line %d
        !            82: 
        !            83: Warning: touch(): Unable to create file  because No such file or directory in %s on line %d
        !            84: 
        !            85: Warning: touch(): Unable to create file  because No such file or directory in %s on line %d
        !            86: bool(false)
        !            87: bool(false)
        !            88: bool(false)
        !            89: bool(true)
        !            90: bool(true)
        !            91: 
        !            92: *** testing file info ***
        !            93: -- File '' --
        !            94: -- File access time is => 
        !            95: -- File modification time is => 
        !            96: -- inode change time is => 
        !            97: 
        !            98: -- File '' --
        !            99: -- File access time is => 
        !           100: -- File modification time is => 
        !           101: -- inode change time is => 
        !           102: 
        !           103: -- File '' --
        !           104: -- File access time is => 
        !           105: -- File modification time is => 
        !           106: -- inode change time is => 
        !           107: 
        !           108: -- File ' ' --
        !           109: -- File access time is => %d
        !           110: -- File modification time is => %d
        !           111: -- inode change time is => %d
        !           112: 
        !           113: -- File '|' --
        !           114: -- File access time is => %d
        !           115: -- File modification time is => %d
        !           116: -- inode change time is => %d
        !           117: bool(true)
        !           118: bool(true)
        !           119: Done

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