Return to trait_exists_error_001.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / class_object |
1.1 misho 1: --TEST-- 2: Test 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: 15: echo "*** Testing trait_exists() : error conditions ***\n"; 16: 17: // Zero arguments 18: echo "\n-- Testing trait_exists() function with Zero arguments --\n"; 19: var_dump( trait_exists() ); 20: 21: //Test trait_exists with one more than the expected number of arguments 22: echo "\n-- Testing trait_exists() function with more than expected no. of arguments --\n"; 23: $traitname = 'string_val'; 24: $autoload = true; 25: $extra_arg = 10; 26: var_dump( trait_exists($traitname, $autoload, $extra_arg) ); 27: 28: echo "Done"; 29: ?> 30: --EXPECTF-- 31: *** Testing trait_exists() : error conditions *** 32: 33: -- Testing trait_exists() function with Zero arguments -- 34: 35: Warning: trait_exists() expects at least 1 parameter, 0 given in %s on line 16 36: NULL 37: 38: -- Testing trait_exists() function with more than expected no. of arguments -- 39: 40: Warning: trait_exists() expects at most 2 parameters, 3 given in %s on line 23 41: NULL 42: Done