ReflectionClass_hasMethod_002.phpt 992 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. ReflectionClass::hasMethod() - 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. $rc = new ReflectionClass("C");
  12. echo "Check invalid params:\n";
  13. var_dump($rc->hasMethod());
  14. var_dump($rc->hasMethod("f", "f"));
  15. var_dump($rc->hasMethod(null));
  16. var_dump($rc->hasMethod(1));
  17. var_dump($rc->hasMethod(1.5));
  18. var_dump($rc->hasMethod(true));
  19. var_dump($rc->hasMethod(array(1,2,3)));
  20. var_dump($rc->hasMethod(new C));
  21. ?>
  22. --EXPECTF--
  23. Check invalid params:
  24. Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8
  25. NULL
  26. Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9
  27. NULL
  28. bool(false)
  29. bool(false)
  30. bool(false)
  31. bool(false)
  32. Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14
  33. NULL
  34. Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15
  35. NULL