008.phpt 817 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. ReflectionMethod::__construct() tests
  3. --FILE--
  4. <?php
  5. $a = array("", 1, "::", "a::", "::b", "a::b");
  6. foreach ($a as $val) {
  7. try {
  8. new ReflectionMethod($val);
  9. } catch (Exception $e) {
  10. var_dump($e->getMessage());
  11. }
  12. }
  13. $a = array("", 1, "");
  14. $b = array("", "", 1);
  15. foreach ($a as $key=>$val) {
  16. try {
  17. new ReflectionMethod($val, $b[$key]);
  18. } catch (Exception $e) {
  19. var_dump($e->getMessage());
  20. }
  21. }
  22. echo "Done\n";
  23. ?>
  24. --EXPECTF--
  25. string(20) "Invalid method name "
  26. string(21) "Invalid method name 1"
  27. string(21) "Class does not exist"
  28. string(22) "Class a does not exist"
  29. string(21) "Class does not exist"
  30. string(22) "Class a does not exist"
  31. string(21) "Class does not exist"
  32. string(66) "The parameter class is expected to be either a string or an object"
  33. string(21) "Class does not exist"
  34. Done