From c8b946f8140cebf645d7b5bf5bc7140583a7096d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 12 Jun 2023 17:10:22 +0200 Subject: [PATCH] use serverVersion to skip json test --- package.xml | 1 + tests/_skipif.inc | 5 ++++- tests/basic003.phpt | 22 ++++++++++++++++++++++ tests/gh-issue047_jsonb.phpt | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/basic003.phpt diff --git a/package.xml b/package.xml index 402e0db..1c7ba19 100644 --- a/package.xml +++ b/package.xml @@ -118,6 +118,7 @@ + diff --git a/tests/_skipif.inc b/tests/_skipif.inc index 9bf235c..0391d77 100644 --- a/tests/_skipif.inc +++ b/tests/_skipif.inc @@ -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 index 0000000..4645e8c --- /dev/null +++ b/tests/basic003.phpt @@ -0,0 +1,22 @@ +--TEST-- +basic functionality +--SKIPIF-- + +--FILE-- +libraryVersion); +var_dump($c->protocolVersion); +var_dump($c->serverVersion); +?> +DONE +--EXPECTF-- +Test +string(%d) "%s" +int(%d) +string(%d) "%s" +DONE diff --git a/tests/gh-issue047_jsonb.phpt b/tests/gh-issue047_jsonb.phpt index 1f049d4..5e145fb 100644 --- a/tests/gh-issue047_jsonb.phpt +++ b/tests/gh-issue047_jsonb.phpt @@ -2,6 +2,7 @@ json conv broken since 2.2.1 --SKIPIF-- --INI-- -- 2.30.2