fix issue #9 @github: execAsync - gets another result
[m6w6/ext-pq] / tests / callback002.phpt
diff --git a/tests/callback002.phpt b/tests/callback002.phpt
new file mode 100644 (file)
index 0000000..7d7903b
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+callback sanity
+--SKIPIF--
+<?php include "_skipif.inc"; ?>
+--FILE--
+<?php 
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$c->execAsync("select 1; select 2", function($r) {
+       print_r($r->fetchAll());
+});
+try {
+       $c->execAsync("select 3; select 4", function($r) {
+               
+       });
+} catch (Exception $e) {
+       printf("%s\n", $e->getMessage());
+}
+$c->exec("");
+?>
+===DONE===
+--EXPECT--
+Test
+Failed to execute query (another command is already in progress)
+Array
+(
+    [0] => Array
+        (
+            [0] => 1
+        )
+
+)
+Array
+(
+    [0] => Array
+        (
+            [0] => 2
+        )
+
+)
+===DONE===