use serverVersion to skip json test
authorRemi Collet <remi@remirepo.net>
Mon, 12 Jun 2023 15:10:22 +0000 (17:10 +0200)
committerRemi Collet <remi@php.net>
Mon, 12 Jun 2023 16:27:12 +0000 (18:27 +0200)
package.xml
tests/_skipif.inc
tests/basic003.phpt [new file with mode: 0644]
tests/gh-issue047_jsonb.phpt

index 402e0db8e4bf283b0fd14d71d05d0472708d74ba..1c7ba19e50e6b9a156bf17d1963200801aa3e604 100644 (file)
     <file role="test" name="async010.phpt" />
     <file role="test" name="basic001.phpt" />
     <file role="test" name="basic002.phpt" />
+    <file role="test" name="basic003.phpt" />
     <file role="test" name="bound002.phpt" />
     <file role="test" name="callback001.phpt" />
     <file role="test" name="callback002.phpt" />
index 9bf235c5fa17ec595b7fcd8bd6939e8ba4a48656..0391d77e059a5fd4359defca669f6961a639a934 100644 (file)
@@ -6,7 +6,10 @@ _ext("pq");
 include "_setup.inc";
 defined("PQ_DSN") or die("skip PQ_DSN undefined");
 try {
-       new pq\Connection(PQ_DSN);
+       $c = new pq\Connection(PQ_DSN);
+       if (defined("SERVER_MIN") && version_compare(SERVER_MIN, $c->serverVersion) > 0) {
+               die("skip server {$c->serverVersion} is too old, needed " . SERVER_MIN);
+       }
 } catch (pq\Exception $e) {
        die("skip could not connect to PQ_DSN ".$e->getMessage());
 }
diff --git a/tests/basic003.phpt b/tests/basic003.phpt
new file mode 100644 (file)
index 0000000..4645e8c
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+basic functionality
+--SKIPIF--
+<?php include "_skipif.inc"; ?>
+--FILE--
+<?php
+echo "Test\n";
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+
+var_dump($c->libraryVersion);
+var_dump($c->protocolVersion);
+var_dump($c->serverVersion);
+?>
+DONE
+--EXPECTF--
+Test
+string(%d) "%s"
+int(%d)
+string(%d) "%s"
+DONE
index 1f049d495d71d8e2c00fa3f47b9b81780f2ad45e..5e145fb0bd692541f40edddb9ec56f2e1e38f730 100644 (file)
@@ -2,6 +2,7 @@
 json conv broken since 2.2.1
 --SKIPIF--
 <?php
+define("SERVER_MIN", "9.4");
 include "_skipif.inc";
 ?>
 --INI--