tests & fixes
[m6w6/ext-pq] / tests / exceptions002.phpt
diff --git a/tests/exceptions002.phpt b/tests/exceptions002.phpt
new file mode 100644 (file)
index 0000000..8954571
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+sql exception
+--SKIPIF--
+<?php include "_skipif.inc"; ?>
+--FILE--
+<?php
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+try {
+       $r = $c->exec("SELECT 1 FROM probably_non_existent_table");
+} catch (pq\Exception $e) {
+       var_dump($e instanceof pq\Exception\DomainException);
+       var_dump($e->getCode() == pq\Exception::SQL);
+       var_dump($e->sqlstate);
+}
+?>
+DONE
+--EXPECT--
+Test
+bool(true)
+bool(true)
+string(5) "42P01"
+DONE