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