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

1.1       misho       1: --TEST--
                      2: Test readfile() function: usage variation - stream_context
                      3: --FILE--
                      4: <?php
                      5: /* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] );
                      6:    Description: Outputs a file
                      7: */
                      8: 
                      9: /* test readfile() with third argument : context */
                     10: 
                     11: // include file.inc
                     12: require("file.inc");
                     13: $file_path = dirname(__FILE__);
                     14: 
                     15: /* Variation 1 : Check working of third argument of readfile() */
                     16: 
                     17: echo "*** Testing readfile(): checking third argument ***\n";
                     18: // creating a context
                     19: $context = stream_context_create();
                     20: // temp file name used here
                     21: $filename = "$file_path/readfile_variation1.tmp";
                     22: 
                     23: // create file
                     24: $fp = fopen($filename, "w");
                     25: fill_file($fp, "text_with_new_line", 50);
                     26: fclose($fp);
                     27: $count = readfile($filename, true, $context);
                     28: echo "\n";
                     29: var_dump($count);
                     30: 
                     31: echo "Done\n";
                     32: ?>
                     33: --CLEAN--
                     34: <?php
                     35: unlink(dirname(__FILE__)."/readfile_variation1.tmp");
                     36: ?>
                     37: --EXPECT--
                     38: *** Testing readfile(): checking third argument ***
                     39: line
                     40: line of text
                     41: line
                     42: line of text
                     43: line
                     44: line of t
                     45: int(50)
                     46: Done

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