1--TEST-- 2Test is_file() function: error conditions 3--FILE-- 4<?php 5/* Prototype: bool is_file ( string $filename ); 6 Description: Tells whether the filename is a regular file 7 Returns TRUE if the filename exists and is a regular file 8*/ 9 10echo "*** Testing is_file() error conditions ***"; 11$file_path = dirname(__FILE__); 12var_dump( is_file() ); // Zero No. of args 13 14/* no of args > expected */ 15$file_handle = fopen($file_path."/is_file_error.tmp", "w"); 16var_dump( is_file( $file_path."/is_file_error.tmp", $file_path."/is_file_error1.tmp") ); 17 18/* Non-existing file */ 19var_dump( is_file($file_path."/is_file_error1.tmp") ); 20 21/* Passing resource as an argument */ 22var_dump( is_file($file_handle) ); 23 24fclose($file_handle); 25 26echo "\n*** Done ***"; 27?> 28--CLEAN-- 29<?php 30$file_path = dirname(__FILE__); 31if(file_exists($file_path."/is_file_error.tmp")) { 32 unlink($file_path."/is_file_error.tmp"); 33} 34if(file_exists($file_path."/is_file_error1.tmp")) { 35 unlink($file_path."/is_file_error1.tmp"); 36} 37?> 38--EXPECTF-- 39*** Testing is_file() error conditions *** 40Warning: is_file() expects exactly 1 parameter, 0 given in %s on line %d 41NULL 42 43Warning: is_file() expects exactly 1 parameter, 2 given in %s on line %d 44NULL 45bool(false) 46 47Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d 48NULL 49 50*** Done *** 51