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

1.1     ! misho       1: --TEST--
        !             2: Test copy() function: usage variations - destination file names(case sensitive)
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) )
        !             6:   die("skip do not run on MacOS/Windows");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: /* Prototype: bool copy ( string $source, string $dest );
        !            11:    Description: Makes a copy of the file source to dest.
        !            12:      Returns TRUE on success or FALSE on failure.
        !            13: */
        !            14: 
        !            15: /* Test copy() function: Checking case sensitivity in creation of destination file names 
        !            16:      and the existence and size of destination files
        !            17: */
        !            18: 
        !            19: echo "*** Test copy() function: checking case sensitivity in creation of destination file names ***\n";
        !            20: $file_path = dirname(__FILE__);
        !            21: $src_file_name = $file_path."/copy_variation5.tmp";
        !            22: $file_handle = fopen($src_file_name, "w");
        !            23: fwrite( $file_handle, str_repeat(b"Hello2World...\n", 100) );
        !            24: fclose($file_handle);
        !            25: 
        !            26: /* array of destination file names */
        !            27: $dest_files = array(
        !            28: 
        !            29:   /* Checking case sensitiveness */
        !            30:   "COPY.tmp",
        !            31:   "COPY.TMP",
        !            32:   "CopY.TMP"
        !            33: );
        !            34: 
        !            35: echo "Size of the source file before copy operation => ";
        !            36: var_dump( filesize($src_file_name) );
        !            37: clearstatcache();
        !            38: 
        !            39: echo "\n-- Now applying copy() on source file to create copies --";
        !            40: $count = 1;
        !            41: foreach($dest_files as $dest_file) {
        !            42: 
        !            43:   echo "\n-- Iteration $count --\n";
        !            44:   $dest_file_name = $file_path."/$dest_file";
        !            45: 
        !            46:   echo "Copy operation => ";
        !            47:   var_dump( copy($src_file_name, $dest_file_name) );
        !            48: 
        !            49:   echo "Existence of destination file => ";
        !            50:   var_dump( file_exists($dest_file_name) );
        !            51: 
        !            52:   echo "Destination file name => ";
        !            53:   print($dest_file_name);
        !            54:   echo "\n";
        !            55: 
        !            56:   echo "Size of source file => ";
        !            57:   var_dump( filesize($src_file_name) );
        !            58:   clearstatcache();
        !            59: 
        !            60:   echo "Size of destination file => ";
        !            61:   var_dump( filesize($dest_file_name) );
        !            62:   clearstatcache();
        !            63: 
        !            64:   $count++;
        !            65: }
        !            66: 
        !            67: $count = 1;
        !            68: foreach($dest_files as $dest_file) {
        !            69:   unlink($file_path."/".$dest_file);
        !            70:   $count++;
        !            71: }
        !            72: 
        !            73: echo "*** Done ***\n";
        !            74: ?>
        !            75: 
        !            76: --CLEAN--
        !            77: <?php
        !            78: unlink(dirname(__FILE__)."/copy_variation5.tmp");
        !            79: ?>
        !            80: 
        !            81: --EXPECTF--
        !            82: *** Test copy() function: checking case sensitivity in creation of destination file names ***
        !            83: Size of the source file before copy operation => int(1500)
        !            84: 
        !            85: -- Now applying copy() on source file to create copies --
        !            86: -- Iteration 1 --
        !            87: Copy operation => bool(true)
        !            88: Existence of destination file => bool(true)
        !            89: Destination file name => %s/COPY.tmp
        !            90: Size of source file => int(1500)
        !            91: Size of destination file => int(1500)
        !            92: 
        !            93: -- Iteration 2 --
        !            94: Copy operation => bool(true)
        !            95: Existence of destination file => bool(true)
        !            96: Destination file name => %s/COPY.TMP
        !            97: Size of source file => int(1500)
        !            98: Size of destination file => int(1500)
        !            99: 
        !           100: -- Iteration 3 --
        !           101: Copy operation => bool(true)
        !           102: Existence of destination file => bool(true)
        !           103: Destination file name => %s/CopY.TMP
        !           104: Size of source file => int(1500)
        !           105: Size of destination file => int(1500)
        !           106: *** Done ***

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