Return to property_exists_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / class_object |
1.1 misho 1: --TEST-- 2: Test property_exists() function : error conditions 3: --FILE-- 4: <?php 5: /* Prototype : bool property_exists(mixed object_or_class, string property_name) 6: * Description: Checks if the object or class has a property 7: * Source code: Zend/zend_builtin_functions.c 8: * Alias to functions: 9: */ 10: 11: echo "*** Testing property_exists() : error conditions ***\n"; 12: 13: $object_or_class = "obj"; 14: $property_name = 'string_val'; 15: $extra_arg = 10; 16: 17: 18: echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n"; 19: var_dump( property_exists($object_or_class, $property_name, $extra_arg) ); 20: 21: 22: echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n"; 23: var_dump( property_exists($object_or_class) ); 24: 25: echo "\n-- Testing property_exists() function with incorrect arguments --\n"; 26: var_dump( property_exists(10, $property_name) ); 27: 28: ?> 29: ===DONE=== 30: --EXPECTF-- 31: *** Testing property_exists() : error conditions *** 32: 33: -- Testing property_exists() function with more than expected no. of arguments -- 34: 35: Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d 36: NULL 37: 38: -- Testing property_exists() function with less than expected no. of arguments -- 39: 40: Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d 41: NULL 42: 43: -- Testing property_exists() function with incorrect arguments -- 44: 45: Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d 46: NULL 47: ===DONE===