Annotation of embedaddon/php/ext/posix/tests/posix_setgid_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test function posix_setgid() by substituting argument 1 with object values.
3: --SKIPIF--
4: <?php
5: if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
6: ?>
7: --CREDITS--
8: Marco Fabbri mrfabbri@gmail.com
9: Francesco Fullone ff@ideato.it
10: #PHPTestFest Cesena Italia on 2009-06-20
11: --FILE--
12: <?php
13:
14:
15: echo "*** Test substituting argument 1 with object values ***\n";
16:
17:
18:
19: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
20: if (error_reporting() != 0) {
21: // report non-silenced errors
22: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
23: }
24: }
25: set_error_handler('test_error_handler');
26:
27:
28:
29: class classWithToString
30: {
31: public function __toString() {
32: return "Class A object";
33: }
34: }
35:
36: class classWithoutToString
37: {
38: }
39:
40: $variation_array = array(
41: 'instance of classWithToString' => new classWithToString(),
42: 'instance of classWithoutToString' => new classWithoutToString(),
43: );
44:
45:
46: foreach ( $variation_array as $var ) {
47: var_dump(posix_setgid( $var ) );
48: }
49: ?>
50: ===DONE===
51: --EXPECTF--
52: *** Test substituting argument 1 with object values ***
53: Error: 2 - posix_setgid() expects parameter 1 to be long, object given, %s
54: bool(false)
55: Error: 2 - posix_setgid() expects parameter 1 to be long, object given, %s
56: bool(false)
57: ===DONE===
58:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>