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

1.1       misho       1: --TEST--
                      2: Test file_get_contents() and file_put_contents() functions : usage variations - all arguments
                      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 in all argument values */
                     16: $file_path = dirname(__FILE__);
                     17: include($file_path."/file.inc");
                     18: 
                     19: echo "*** Testing with variations in the arguments values ***\n";
                     20: 
                     21: $buffer_types = array("text", "numeric", "text_with_new_line", "alphanumeric");
                     22: 
                     23: foreach( $buffer_types as $type) {
                     24:   fill_buffer($buffer, $type, 100);
                     25:   file_put_contents( $file_path."/file_put_contents_variation1.tmp", $buffer);
                     26:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0) );
                     27:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1) );
                     28:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5) );
                     29:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5) );
                     30:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5, 20) );
                     31:   var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5, 20) );
                     32: 
                     33: }
                     34: 
                     35: echo "--- Done ---";
                     36: ?>
                     37: --CLEAN--
                     38: <?php
                     39: //Deleting the temporary file 
                     40: 
                     41: $file_path = dirname(__FILE__);
                     42: unlink($file_path."/file_put_contents_variation1.tmp");
                     43: ?>
                     44: --EXPECTF--
                     45: *** Testing with variations in the arguments values ***
                     46: string(100) "text text text text text text text text text text text text text text text text text text text text "
                     47: string(100) "text text text text text text text text text text text text text text text text text text text text "
                     48: string(95) "text text text text text text text text text text text text text text text text text text text "
                     49: string(95) "text text text text text text text text text text text text text text text text text text text "
                     50: string(20) "text text text text "
                     51: string(20) "text text text text "
                     52: string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
                     53: string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
                     54: string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
                     55: string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
                     56: string(20) "22222222222222222222"
                     57: string(20) "22222222222222222222"
                     58: string(100) "line
                     59: line of text
                     60: line
                     61: line of text
                     62: line
                     63: line of text
                     64: line
                     65: line of text
                     66: line
                     67: line of text
                     68: line
                     69: line "
                     70: string(100) "line
                     71: line of text
                     72: line
                     73: line of text
                     74: line
                     75: line of text
                     76: line
                     77: line of text
                     78: line
                     79: line of text
                     80: line
                     81: line "
                     82: string(95) "line of text
                     83: line
                     84: line of text
                     85: line
                     86: line of text
                     87: line
                     88: line of text
                     89: line
                     90: line of text
                     91: line
                     92: line "
                     93: string(95) "line of text
                     94: line
                     95: line of text
                     96: line
                     97: line of text
                     98: line
                     99: line of text
                    100: line
                    101: line of text
                    102: line
                    103: line "
                    104: string(20) "line of text
                    105: line
                    106: li"
                    107: string(20) "line of text
                    108: line
                    109: li"
                    110: string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
                    111: string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
                    112: string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
                    113: string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
                    114: string(20) "ab12 ab12 ab12 ab12 "
                    115: string(20) "ab12 ab12 ab12 ab12 "
                    116: --- Done ---

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