class_uses_variation.phpt 845 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. SPL: Test class_uses() function : variation - no interfaces and autoload
  3. --FILE--
  4. <?php
  5. echo "*** Testing class_uses() : variation ***\n";
  6. echo "--- testing no traits ---\n";
  7. class fs {}
  8. var_dump(class_uses(new fs));
  9. var_dump(class_uses('fs'));
  10. spl_autoload_register(function ($classname) {
  11. echo "attempting to autoload $classname\n";
  12. });
  13. echo "\n--- testing autoload ---\n";
  14. var_dump(class_uses('non_existent'));
  15. var_dump(class_uses('non_existent2', false));
  16. ?>
  17. --EXPECTF--
  18. *** Testing class_uses() : variation ***
  19. --- testing no traits ---
  20. array(0) {
  21. }
  22. array(0) {
  23. }
  24. --- testing autoload ---
  25. attempting to autoload non_existent
  26. Warning: class_uses(): Class non_existent does not exist and could not be loaded in %s on line %d
  27. bool(false)
  28. Warning: class_uses(): Class non_existent2 does not exist in %s on line %d
  29. bool(false)