class_implements_variation.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. SPL: Test class_implements() function : variation - no interfaces and autoload
  3. --FILE--
  4. <?php
  5. /* Prototype : array class_implements(mixed what [, bool autoload ])
  6. * Description: Return all classes and interfaces implemented by SPL
  7. * Source code: ext/spl/php_spl.c
  8. * Alias to functions:
  9. */
  10. echo "*** Testing class_implements() : variation ***\n";
  11. echo "--- testing no interfaces ---\n";
  12. class fs {}
  13. var_dump(class_implements(new fs));
  14. var_dump(class_implements('fs'));
  15. echo "\n--- testing autoload ---\n";
  16. var_dump(class_implements('non_existent'));
  17. var_dump(class_implements('non_existent2', false));
  18. function __autoload($classname) {
  19. echo "attempting to autoload $classname\n";
  20. }
  21. ?>
  22. ===DONE===
  23. --EXPECTF--
  24. *** Testing class_implements() : variation ***
  25. --- testing no interfaces ---
  26. array(0) {
  27. }
  28. array(0) {
  29. }
  30. --- testing autoload ---
  31. attempting to autoload non_existent
  32. Warning: class_implements(): Class non_existent does not exist and could not be loaded in %s on line %d
  33. bool(false)
  34. Warning: class_implements(): Class non_existent2 does not exist in %s on line %d
  35. bool(false)
  36. ===DONE===