import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / readfile_basic.php
blob6fd33cdb7686cb8556e693944c59d0486c84ee05
1 <?php
2 /* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
3 Description: Outputs a file
4 */
5 // common file used
6 require(dirname(__FILE__) . '/file.inc');
8 echo "*** Testing readfile() : basic functionality ***\n";
9 $file_path = dirname(__FILE__);
10 $file_prefix = "readfile_basic"; // temp files created with this prefix
12 // the content that is filled into the temp files as created
13 $filetypes = array("numeric", "text", "empty", "alphanumeric", "text_with_new_line");
14 // different file modes
15 $filemodes = array("w", "wt", "wb", "w+", "w+b", "w+t",
16 "a", "at", "ab", "a+", "a+b", "a+t",
17 "x", "xb", "xt", "x+", "x+b", "x+t");
19 // create file, read the file content, delete file
20 foreach($filetypes as $type) {
21 echo "\n-- File filled with content type: $type --\n";
22 foreach($filemodes as $mode) {
23 echo "-- File opened with mode: $mode --\n";
24 if ( strstr($mode, "x") ) {
25 $fp = fopen($file_path."/".$file_prefix."1.tmp", $mode);
26 fill_file($fp, $type, 100);
27 fclose($fp);
28 } else {
29 // creating file in write mode
30 create_files($file_path, 1, $type, 0755, 100, $mode, $file_prefix, 1, "byte");
32 $count = readfile($file_path."/".$file_prefix."1.tmp");
33 echo "\n";
34 var_dump($count);
35 // delete files created
36 delete_files($file_path, 1, $file_prefix, 1);
39 echo "Done\n";