Skip to content

Commit 439c190

Browse files
committed
pgsqlSetNoticeCallback: test case for method callback
1 parent e80b1af commit 439c190

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
pgsqlSetNoticeCallback catches Postgres "raise notice".
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
6+
require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
7+
require_once dirname(__FILE__) . '/config.inc';
8+
PDOTest::skip();
9+
?>
10+
--FILE--
11+
<?php
12+
class Logger
13+
{
14+
public function disp($message) { echo trim($message)."\n"; }
15+
public function dispRe($message) { echo "Re".trim($message)."\n"; }
16+
}
17+
$logger = new Logger();
18+
function attach($db, $prefix = '')
19+
{
20+
global $logger;
21+
$db->pgsqlSetNoticeCallback(array($logger, 'disp'.$prefix));
22+
}
23+
require dirname(__FILE__) . '/issue78621.inc';
24+
?>
25+
--EXPECT--
26+
NOTICE: I tampered your data, did you know?
27+
ReNOTICE: I tampered your data, did you know?
28+
array(1) {
29+
[0]=>
30+
array(1) {
31+
["a"]=>
32+
string(2) "oh"
33+
}
34+
}
35+
Done

0 commit comments

Comments
 (0)