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

1.1     ! misho       1: --TEST--
        !             2: Test fileperms() & chmod() functions: basic functionality
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (substr(PHP_OS, 0, 3) == 'WIN') {
        !             6:     die('skip Not on Windows');
        !             7: }
        !             8: // Skip if being run by root
        !             9: $filename = dirname(__FILE__)."/006_root_check.tmp";
        !            10: $fp = fopen($filename, 'w');
        !            11: fclose($fp);
        !            12: if(fileowner($filename) == 0) {
        !            13:         unlink ($filename);
        !            14:         die('skip cannot be run as root');
        !            15: }
        !            16: 
        !            17: unlink($filename);
        !            18: 
        !            19: ?>
        !            20: --FILE--
        !            21: <?php
        !            22: /*
        !            23:   Prototype: int fileperms ( string $filename );
        !            24:   Description: Returns the permissions on the file, or FALSE in case of an error
        !            25: 
        !            26:   Prototype: bool chmod ( string $filename, int $mode );
        !            27:   Description: Attempts to change the mode of the file specified by
        !            28:     filename to that given in mode
        !            29: */
        !            30: $path = dirname(__FILE__);
        !            31: 
        !            32: echo "*** Testing fileperms(), chmod() with files and dirs ***\n"; 
        !            33: fopen($path."/perm.tmp", "w");
        !            34: var_dump( chmod($path."/perm.tmp", 0755 ) );
        !            35: printf("%o", fileperms($path."/perm.tmp") );
        !            36: echo "\n";
        !            37: clearstatcache();
        !            38: 
        !            39: mkdir($path."/perm");
        !            40: var_dump( chmod( $path."/perm", 0777 ) );
        !            41: printf("%o", fileperms($path."/perm") );
        !            42: echo "\n";
        !            43: clearstatcache();
        !            44: 
        !            45: echo "Done\n";
        !            46: ?>
        !            47: --CLEAN--
        !            48: <?php
        !            49: unlink(dirname(__FILE__)."/perm.tmp");
        !            50: rmdir(dirname(__FILE__)."/perm");
        !            51: ?>
        !            52: --EXPECTF--
        !            53: *** Testing fileperms(), chmod() with files and dirs ***
        !            54: bool(true)
        !            55: 100755
        !            56: bool(true)
        !            57: 40777
        !            58: Done

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