1--TEST-- 2Test tempnam() function: error conditions 3--FILE-- 4<?php 5/* Prototype: string tempnam ( string $dir, string $prefix ); 6 Description: Create file with unique file name. 7*/ 8 9echo "*** Testing tempnam() error conditions ***\n"; 10$file_path = dirname(__FILE__); 11 12/* More number of arguments than expected */ 13var_dump( tempnam("$file_path", "tempnam_error.tmp", "") ); //Two Valid & One Invalid 14var_dump( tempnam("$file_path", "tempnam_error.tmp", TRUE) ); 15 16/* Less number of arguments than expected */ 17var_dump( tempnam("tempnam_error") ); //One Valid arg 18var_dump( tempnam("$file_path") ); //One Valid arg 19var_dump( tempnam("") ); //Empty string 20var_dump( tempnam(NULL) ); //NULL as arg 21var_dump( tempnam() ); //Zero args 22 23echo "*** Done ***\n"; 24?> 25--EXPECTF-- 26*** Testing tempnam() error conditions *** 27 28Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d 29NULL 30 31Warning: tempnam() expects exactly 2 parameters, 3 given in %s on line %d 32NULL 33 34Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d 35NULL 36 37Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d 38NULL 39 40Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d 41NULL 42 43Warning: tempnam() expects exactly 2 parameters, 1 given in %s on line %d 44NULL 45 46Warning: tempnam() expects exactly 2 parameters, 0 given in %s on line %d 47NULL 48*** Done *** 49