Annotation of embedaddon/php/ext/sybase_ct/tests/test_msghandler.phpt, revision 1.1.1.3
1.1 misho 1: --TEST--
2: Sybase-CT server message handler
3: --SKIPIF--
4: <?php require('skipif.inc'); ?>
5: --FILE--
6: <?php
7: /* This file is part of PHP test framework for ext/sybase_ct
8: *
1.1.1.2 misho 9: * $Id$
1.1 misho 10: */
11:
12: require('test.inc');
13:
14: $db= sybase_connect_ex();
15:
1.1.1.3 ! misho 16: echo 'Nonexistent: '; sybase_set_messagehandler_ex('function_does_not_exist');
1.1 misho 17: echo 'Static method: '; sybase_set_messagehandler_ex(array('sybase', 'static_handler'));
18: echo 'Instance method: '; sybase_set_messagehandler_ex(array(new sybase(), 'handler'));
19: echo 'Lambda function: '; sybase_set_messagehandler_ex(create_function('', 'return FALSE;'));
20: echo 'Unset: '; sybase_set_messagehandler_ex(NULL);
21: echo 'Incorrect type: '; sybase_set_messagehandler_ex(1);
22: echo 'Function: '; sybase_set_messagehandler_ex('sybase_msg_handler');
23:
24: var_dump(sybase_select_ex($db, 'select getdate(NULL)'));
25: sybase_close($db);
26: ?>
27: --EXPECTF--
1.1.1.3 ! misho 28: Nonexistent:
1.1 misho 29: Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, function 'function_does_not_exist' not found or invalid function name in %stest.inc on line %d
30: NULL
31: Static method: bool(true)
32: Instance method: bool(true)
33: Lambda function: bool(true)
34: Unset: bool(true)
35: Incorrect type:
36: Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, no array or string given in %stest.inc on line %d
37: NULL
38: Function: bool(true)
39: >>> Query: select getdate(NULL)
40: *** Caught Sybase Server Message #%d [Severity %d, state %d] at line %d
41: %s
42: <<< Return: boolean
43: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>