1--TEST--
2Test 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 */
10require(dirname(__FILE__) . '/file.inc');
11$file_path = dirname(__FILE__);
12echo "*** Testing file() with basic types of files ***\n";
13$filetypes = array("numeric", "text", "empty", "text_with_new_line");
14
15foreach( $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
21echo "*** Testing for return type of file() function ***\n";
22foreach( $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
29echo "\n--- Done ---";
30?>
31--EXPECTF--
32*** Testing file() with basic types of files ***
33Array
34(
35    [0] => 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
36)
37Array
38(
39    [0] => text text text text text text text text text text text text text text text text text text text text
40)
41Array
42(
43)
44Array
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 ***
71bool(true)
72bool(true)
73bool(true)
74bool(true)
75
76--- Done ---
77
78