Annotation of embedaddon/php/ext/standard/tests/file/file_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test file() function : error conditions
        !             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: */
        !            10: $file_path = dirname(__FILE__);
        !            11: echo "\n*** Testing error conditions ***";
        !            12: $file_handle = fopen($file_path."/file.tmp", "w");
        !            13: var_dump( file() );  // Zero No. of args
        !            14: 
        !            15: $filename = $file_path."/file.tmp";
        !            16: var_dump( file($filename, $filename, $filename, $filename) );  // more than expected number of arguments
        !            17: 
        !            18: var_dump( file($filename, "INCORRECT_FLAG", NULL) );  //  Incorrect flag
        !            19: var_dump( file($filename, 10, NULL) );  //  Incorrect flag
        !            20: 
        !            21: var_dump( file("temp.tmp") );  // non existing filename 
        !            22: fclose($file_handle);
        !            23: 
        !            24: echo "\n--- Done ---";
        !            25: ?>
        !            26: --CLEAN--
        !            27: <?php
        !            28: $file_path = dirname(__FILE__);
        !            29: unlink($file_path."/file.tmp");
        !            30: ?>
        !            31: --EXPECTF--
        !            32: *** Testing error conditions ***
        !            33: Warning: file() expects at least 1 parameter, 0 given in %s on line %d
        !            34: NULL
        !            35: 
        !            36: Warning: file() expects at most 3 parameters, 4 given in %s on line %d
        !            37: NULL
        !            38: 
        !            39: Warning: file() expects parameter 2 to be long, string given in %s on line %d
        !            40: NULL
        !            41: array(0) {
        !            42: }
        !            43: 
        !            44: Warning: file(temp.tmp): failed to open stream: No such file or directory in %s on line %d
        !            45: bool(false)
        !            46: 
        !            47: --- Done ---
        !            48: 

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