test #47
[m6w6/ext-pq] / tests / gh-issue047_jsonb.phpt
diff --git a/tests/gh-issue047_jsonb.phpt b/tests/gh-issue047_jsonb.phpt
new file mode 100644 (file)
index 0000000..1f049d4
--- /dev/null
@@ -0,0 +1,40 @@
+--TEST--
+json conv broken since 2.2.1
+--SKIPIF--
+<?php
+include "_skipif.inc";
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$c->defaultFetchType = \pq\Result::FETCH_ASSOC;
+
+$q = <<<EOF
+    SELECT '0'::jsonb UNION SELECT '"text"'::jsonb;
+EOF;
+$r = $c->exec($q);
+
+var_dump($r->fetchAll());
+?>
+===DONE===
+--EXPECT--
+Test
+array(2) {
+  [0]=>
+  array(1) {
+    ["jsonb"]=>
+    string(4) "text"
+  }
+  [1]=>
+  array(1) {
+    ["jsonb"]=>
+    int(0)
+  }
+}
+===DONE===