posix_ttyname_variation6.phpt 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test function posix_ttyname() by substituting argument 1 with object values.
  3. --CREDITS--
  4. Marco Fabbri mrfabbri@gmail.com
  5. Francesco Fullone ff@ideato.it
  6. #PHPTestFest Cesena Italia on 2009-06-20
  7. --EXTENSIONS--
  8. posix
  9. --FILE--
  10. <?php
  11. echo "*** Test substituting argument 1 with object values ***\n";
  12. class classWithToString
  13. {
  14. public function __toString() {
  15. return "Class A object";
  16. }
  17. }
  18. class classWithoutToString
  19. {
  20. }
  21. $variation_array = array(
  22. 'instance of classWithToString' => new classWithToString(),
  23. 'instance of classWithoutToString' => new classWithoutToString(),
  24. );
  25. foreach ( $variation_array as $var ) {
  26. var_dump(posix_ttyname( $var ) );
  27. }
  28. ?>
  29. --EXPECTF--
  30. *** Test substituting argument 1 with object values ***
  31. Warning: Object of class classWithToString could not be converted to int in %s on line %d
  32. bool(false)
  33. Warning: Object of class classWithoutToString could not be converted to int in %s on line %d
  34. bool(false)