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