1--TEST-- 2Test class_exists() function : error conditions (wrong number of arguments) 3--FILE-- 4<?php 5/* Prototype : proto bool class_exists(string classname [, bool autoload]) 6 * Description: Checks if the class exists 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10 11/** 12 * Test wrong number of arguments 13 */ 14 15echo "*** Testing class_exists() : error conditions ***\n"; 16 17// Zero arguments 18echo "\n-- Testing class_exists() function with Zero arguments --\n"; 19var_dump( class_exists() ); 20 21//Test class_exists with one more than the expected number of arguments 22echo "\n-- Testing class_exists() function with more than expected no. of arguments --\n"; 23$classname = 'string_val'; 24$autoload = true; 25$extra_arg = 10; 26var_dump( class_exists($classname, $autoload, $extra_arg) ); 27 28echo "Done"; 29?> 30--EXPECTF-- 31*** Testing class_exists() : error conditions *** 32 33-- Testing class_exists() function with Zero arguments -- 34 35Warning: class_exists() expects at least 1 parameter, 0 given in %s on line 16 36NULL 37 38-- Testing class_exists() function with more than expected no. of arguments -- 39 40Warning: class_exists() expects at most 2 parameters, 3 given in %s on line 23 41NULL 42Done 43