Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_getMethod_002.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionClass::getMethod() - error cases
                      3: --CREDITS--
                      4: Robin Fernandes <robinf@php.net>
                      5: Steve Seear <stevseea@php.net>
                      6: --FILE--
                      7: <?php
                      8: class C {
                      9:        function f() {}
                     10: }
                     11: 
                     12: $rc = new ReflectionClass("C");
                     13: echo "Check invalid params:\n";
                     14: try {
                     15:        var_dump($rc->getMethod());
                     16: } catch (Exception $e) {
                     17:        echo $e->getMessage() . "\n"; 
                     18: }
                     19: try {
                     20:        var_dump($rc->getMethod("f", "f"));
                     21: } catch (Exception $e) {
                     22:        echo $e->getMessage() . "\n"; 
                     23: }
                     24: try {
                     25:        var_dump($rc->getMethod(null));
                     26: } catch (Exception $e) {
                     27:        echo $e->getMessage() . "\n"; 
                     28: }
                     29: try {
                     30:        var_dump($rc->getMethod(1));
                     31: } catch (Exception $e) {
                     32:        echo $e->getMessage() . "\n"; 
                     33: }
                     34: try {
                     35:        var_dump($rc->getMethod(1.5));
                     36: } catch (Exception $e) {
                     37:        echo $e->getMessage() . "\n"; 
                     38: }
                     39: try {
                     40:        var_dump($rc->getMethod(true));
                     41: } catch (Exception $e) {
                     42:        echo $e->getMessage() . "\n"; 
                     43: }
                     44: try {
                     45:        var_dump($rc->getMethod(array(1,2,3)));
                     46: } catch (Exception $e) {
                     47:        echo $e->getMessage() . "\n"; 
                     48: }
                     49: try {
                     50:        var_dump($rc->getMethod(new C));
                     51: } catch (Exception $e) {
                     52:        echo $e->getMessage() . "\n"; 
                     53: }
                     54: 
                     55: 
                     56: ?>
                     57: --EXPECTF--
                     58: Check invalid params:
                     59: 
                     60: Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9
                     61: NULL
                     62: 
                     63: Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14
                     64: NULL
                     65: Method  does not exist
                     66: Method 1 does not exist
                     67: Method 1.5 does not exist
                     68: Method 1 does not exist
                     69: 
                     70: Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39
                     71: NULL
                     72: 
                     73: Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44
                     74: NULL

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