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

1.1       misho       1: --TEST--
                      2: Test file() function : basic functionality
                      3: --FILE--
                      4: <?php
                      5: /* 
                      6:  * Prototype: array file ( string filename [,int use-include_path [,resource context]] );
                      7:  * Description: Reads entire file into an array
                      8:  *              Returns the  file in an array
                      9:  */
                     10: require(dirname(__FILE__) . '/file.inc');
                     11: $file_path = dirname(__FILE__);
                     12: echo "*** Testing file() with basic types of files ***\n";
                     13: $filetypes = array("numeric", "text", "empty", "text_with_new_line");
                     14: 
                     15: foreach( $filetypes as $type ) {
                     16:   create_files($file_path, 1, $type, 0755, 100, "w", "file_basic", 1, "byte");
                     17:   print_r( file($file_path."/file_basic1.tmp") );
                     18:   delete_files($file_path, 1, "file_basic");
                     19: }
                     20: 
                     21: echo "*** Testing for return type of file() function ***\n";
                     22: foreach( $filetypes as $type ) {
                     23:   create_files($file_path, 1, $type, 0755, 1, "w", "file_basic");
                     24:   $ret_arr =  file($file_path."/file_basic1.tmp");
                     25:   var_dump( is_array($ret_arr) );
                     26:   delete_files($file_path, 1, "file_basic");
                     27: }
                     28: 
                     29: echo "\n--- Done ---";
                     30: ?>
                     31: --EXPECTF--
                     32: *** Testing file() with basic types of files ***
                     33: Array
                     34: (
                     35:     [0] => 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
                     36: )
                     37: Array
                     38: (
                     39:     [0] => text text text text text text text text text text text text text text text text text text text text 
                     40: )
                     41: Array
                     42: (
                     43: )
                     44: Array
                     45: (
                     46:     [0] => line
                     47: 
                     48:     [1] => line of text
                     49: 
                     50:     [2] => line
                     51: 
                     52:     [3] => line of text
                     53: 
                     54:     [4] => line
                     55: 
                     56:     [5] => line of text
                     57: 
                     58:     [6] => line
                     59: 
                     60:     [7] => line of text
                     61: 
                     62:     [8] => line
                     63: 
                     64:     [9] => line of text
                     65: 
                     66:     [10] => line
                     67: 
                     68:     [11] => line 
                     69: )
                     70: *** Testing for return type of file() function ***
                     71: bool(true)
                     72: bool(true)
                     73: bool(true)
                     74: bool(true)
                     75: 
                     76: --- Done ---
                     77: 

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