From c223e1c70b1b8bf27e44f481242dbaa6d6710462 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 25 Nov 2014 13:43:48 +0100 Subject: [PATCH] add tests --- tests/crash_result_iterator.phpt | 41 +++++++++++++++++++++ tests/crash_stm_reverse_dep.phpt | 20 +++++++++++ tests/crash_unbuffered_async_prepare.phpt | 43 +++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 tests/crash_result_iterator.phpt create mode 100644 tests/crash_stm_reverse_dep.phpt create mode 100644 tests/crash_unbuffered_async_prepare.phpt diff --git a/tests/crash_result_iterator.phpt b/tests/crash_result_iterator.phpt new file mode 100644 index 0000000..c3b4595 --- /dev/null +++ b/tests/crash_result_iterator.phpt @@ -0,0 +1,41 @@ +--TEST-- +crash result iterator +--SKIPIF-- + +--FILE-- +exec($sql) as $row) { + var_dump($row); +} +?> +===DONE=== +--EXPECT-- +Test +array(1) { + [0]=> + int(1) +} +array(1) { + [0]=> + int(2) +} +array(1) { + [0]=> + int(3) +} +===DONE=== diff --git a/tests/crash_stm_reverse_dep.phpt b/tests/crash_stm_reverse_dep.phpt new file mode 100644 index 0000000..4110f59 --- /dev/null +++ b/tests/crash_stm_reverse_dep.phpt @@ -0,0 +1,20 @@ +--TEST-- +crash stm reverse dependency from connection +--SKIPIF-- + +--FILE-- +s = $c->prepare("test", "SELECT 1"); + +?> +===DONE=== +--EXPECT-- +Test +===DONE=== diff --git a/tests/crash_unbuffered_async_prepare.phpt b/tests/crash_unbuffered_async_prepare.phpt new file mode 100644 index 0000000..9543fc3 --- /dev/null +++ b/tests/crash_unbuffered_async_prepare.phpt @@ -0,0 +1,43 @@ +--TEST-- +crash unbuffered async prepare +--SKIPIF-- + +--FILE-- +busy) { + $r = array($c->socket); + $w = $e = null; + if (stream_select($r, $w, $e, null)) { + $c->poll(); + } + } + } while ($c->getResult()); +} + +try { + $c = new pq\Connection(PQ_DSN); + $c->unbuffered = true; + + $s = $c->prepareAsync("test", "SELECT * from generate_series(1,2)"); + complete($c); + + $r = $s->execAsync(); + complete($c); +} catch (Exception $e) { + echo $e; +} +unset($c); + +?> +===DONE=== +--EXPECT-- +Test +===DONE=== \ No newline at end of file