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