Annotation of embedaddon/php/ext/standard/tests/class_object/method_exists_error_001.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>