Annotation of embedaddon/php/ext/standard/tests/general_functions/proc_nice_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test function proc_nice() by substituting argument 1 with object values.
3: --CREDITS--
4: Italian PHP TestFest 2009 Cesena 19-20-21 june
5: Fabio Fabbrucci (fabbrucci@grupporetina.com)
6: Michele Orselli (mo@ideato.it)
7: Simone Gentili (sensorario@gmail.com)
8: --SKIPIF--
9: <?php
10: if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
11: ?>
12: --FILE--
13: <?php
14:
15:
16: echo "*** Test substituting argument 1 with object values ***\n";
17:
18:
19:
20: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
21: if (error_reporting() != 0) {
22: // report non-silenced errors
23: echo "Error: $err_no - $err_msg, $filename($linenum)\n";
24: }
25: }
26: set_error_handler('test_error_handler');
27:
28:
29:
30: class classWithToString
31: {
32: public function __toString() {
33: return "Class A object";
34: }
35: }
36:
37: class classWithoutToString
38: {
39: }
40:
41: $variation_array = array(
42: 'instance of classWithToString' => new classWithToString(),
43: 'instance of classWithoutToString' => new classWithoutToString(),
44: );
45:
46:
47: foreach ( $variation_array as $var ) {
48: var_dump(proc_nice( $var ) );
49: }
50: ?>
51: --EXPECTF--
52: *** Test substituting argument 1 with object values ***
53: Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
54: bool(false)
55: Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
56: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>