tests: set lc_messages to C for tests checking errors
[m6w6/ext-pq] / tests / cancel001.phpt
1 --TEST--
2 cancel
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 $c = new pq\Connection(PQ_DSN);
12 $c->exec("SET lc_messages TO 'C'");
13
14 $x = new pq\Cancel($c);
15
16 $c->execAsync("SELECT pg_sleep(10)");
17
18 $x->cancel();
19
20 var_dump($c === $x->connection);
21 var_dump($c->getResult());
22 printf("%s\n", $c->errorMessage);
23 ?>
24 DONE
25 --EXPECTF--
26 Test
27 bool(true)
28 object(pq\Result)#%d (9) {
29 ["status"]=>
30 int(7)
31 ["statusMessage"]=>
32 string(11) "FATAL_ERROR"
33 ["errorMessage"]=>
34 string(47) "ERROR: canceling statement due to user request"
35 ["diag"]=>
36 array(17) {
37 ["severity"]=>
38 string(5) "ERROR"
39 ["sqlstate"]=>
40 string(5) "57014"
41 ["message_primary"]=>
42 string(39) "canceling statement due to user request"
43 ["message_detail"]=>
44 NULL
45 ["message_hint"]=>
46 NULL
47 ["statement_position"]=>
48 NULL
49 ["internal_position"]=>
50 NULL
51 ["internal_query"]=>
52 NULL
53 ["context"]=>
54 NULL
55 ["schema_name"]=>
56 NULL
57 ["table_name"]=>
58 NULL
59 ["column_name"]=>
60 NULL
61 ["datatype_name"]=>
62 NULL
63 ["constraint_name"]=>
64 NULL
65 ["source_file"]=>
66 string(10) "postgres.c"
67 ["source_line"]=>
68 string(4) "%d"
69 ["source_function"]=>
70 string(17) "ProcessInterrupts"
71 }
72 ["numRows"]=>
73 int(0)
74 ["numCols"]=>
75 int(0)
76 ["affectedRows"]=>
77 int(0)
78 ["fetchType"]=>
79 int(0)
80 ["autoConvert"]=>
81 int(65535)
82 }
83 ERROR: canceling statement due to user request
84 DONE