Annotation of embedaddon/php/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test file_get_contents() and file_put_contents() functions : usage variations - use_include_path
                      3: 
                      4: --FILE--
                      5: <?php
                      6: /* Prototype: string file_get_contents( string $filename[, bool $use_include_path[, 
                      7:  *                                      resource $context[, int $offset[, int $maxlen]]]] )
                      8:  * Description: Reads entire file into a string
                      9:  */
                     10: 
                     11: /* Prototype: int file_put_contents( string $filename, mixed $data[,int $flags[, resource $context]] )
                     12:  * Description: Write a string to a file
                     13:  */
                     14: 
                     15: /* Testing variation using use_include_path argument */
                     16: $file_path = dirname(__FILE__);
                     17: include($file_path."/file.inc");
                     18: 
                     19: echo "*** Testing with variation in use_include_path argument ***\n";
                     20: $dir = "file_get_contents_variation2";
                     21: mkdir($file_path."/".$dir);
                     22: $filename = $file_path."/".$dir."/"."file_get_contents_variation2.tmp";
                     23: 
                     24: ini_set( 'include_path',$file_path."/".$dir );
                     25: 
                     26: $data_array = array( 1, "  Data1 in an array", 2, "  Data2 in an array" );
                     27: fill_buffer( $buffer, "text", 100);
                     28: file_put_contents( $filename, $buffer );
                     29: fill_buffer( $buffer, "numeric", 100);
                     30: file_put_contents( $filename, $buffer, FILE_APPEND, NULL );
                     31: file_put_contents( $filename, $data_array, FILE_APPEND, NULL );
                     32: var_dump( file_get_contents($filename, 0) );
                     33: var_dump( file_get_contents($filename, 1) );
                     34: var_dump( file_get_contents($filename, 0, NULL, 5) );
                     35: var_dump( file_get_contents($filename, 1, NULL, 5) );
                     36: var_dump( file_get_contents($filename, 0, NULL, 5, 20) );
                     37: var_dump( file_get_contents($filename, 1, NULL, 5, 20) );
                     38: 
                     39: echo "--- Done ---";
                     40: ?>
                     41: --CLEAN--
                     42: <?php
                     43: //Deleting the temporary files and directory used in the testcase
                     44: 
                     45: $file_path = dirname(__FILE__);
                     46: unlink($file_path."/file_get_contents_variation2/file_get_contents_variation2.tmp");
                     47: rmdir($file_path."/file_get_contents_variation2");
                     48: ?>
                     49: --EXPECTF--
                     50: *** Testing with variation in use_include_path argument ***
                     51: string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
                     52: string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
                     53: string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
                     54: string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221  Data1 in an array2  Data2 in an array"
                     55: string(20) "text text text text "
                     56: string(20) "text text text text "
                     57: --- Done ---

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