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

1.1       misho       1: --TEST--
                      2: Test readfile() function: usage variation - include path
                      3: --FILE--
                      4: <?php
                      5: /* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
                      6:    Description: Outputs a file
                      7: */
                      8: /* test readfile() by providing an include path, second argument */
                      9: 
                     10: // include file.inc 
                     11: require("file.inc");
                     12: 
                     13: $file_path = dirname(__FILE__);
                     14: $dirname = "$file_path/readfile_variation3";
                     15: 
                     16: echo "*** Testing readfile(): checking second argument, include path ***\n";
                     17: // temp dir created
                     18: mkdir($dirname);
                     19: // temp file name used here
                     20: $filename = "$dirname/readfile_variation3.tmp";
                     21: // create file
                     22: $fp = fopen($filename, "w");
                     23: fill_file($fp, "text_with_new_line", 50);
                     24: fclose($fp);
                     25: 
                     26: // including $dirname in 'include_path'
                     27: ini_set('include_path',$dirname);
                     28: // 'include_path' set to true
                     29: $count = readfile("readfile_variation3.tmp", true);
                     30: echo "\n";
                     31: var_dump($count);
                     32: // use the context argument with include path
                     33: echo "*** Testing readfile(): checking second argument, include path with context specified ***\n";
                     34: $context = stream_context_create();
                     35: $count = readfile("readfile_variation3.tmp", true, $context);
                     36: echo "\n";
                     37: var_dump($count);
                     38: 
                     39: echo "Done\n";
                     40: ?>
                     41: --CLEAN--
                     42: <?php
                     43: unlink(dirname(__FILE__)."/readfile_variation3/readfile_variation3.tmp");
                     44: rmdir(dirname(__FILE__)."/readfile_variation3");
                     45: ?>
                     46: --EXPECT--
                     47: *** Testing readfile(): checking second argument, include path ***
                     48: line
                     49: line of text
                     50: line
                     51: line of text
                     52: line
                     53: line of t
                     54: int(50)
                     55: *** Testing readfile(): checking second argument, include path with context specified ***
                     56: line
                     57: line of text
                     58: line
                     59: line of text
                     60: line
                     61: line of t
                     62: int(50)
                     63: Done

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