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