From 6f6cead21b6d78b9d0dc6d0ea30e417ec72aced4 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 15 Jan 2021 13:25:11 +0100 Subject: [PATCH] adapt some tests for non-superuser environments --- tests/cancel001.phpt | 6 +++++- tests/trans001.phpt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/cancel001.phpt b/tests/cancel001.phpt index a5bf4f3..4ca9664 100644 --- a/tests/cancel001.phpt +++ b/tests/cancel001.phpt @@ -9,7 +9,11 @@ echo "Test\n"; include "_setup.inc"; $c = new pq\Connection(PQ_DSN); -$c->exec("SET lc_messages TO 'C'"); +try { + $c->exec("SET lc_messages TO 'C'"); +} catch (pq\Exception $e) { + // no not fail if we are not superuser +} $x = new pq\Cancel($c); diff --git a/tests/trans001.phpt b/tests/trans001.phpt index 42e8f9e..001dec0 100644 --- a/tests/trans001.phpt +++ b/tests/trans001.phpt @@ -11,7 +11,11 @@ include "_setup.inc"; $c = new pq\Connection(PQ_DSN); $c->exec("DROP TABLE IF EXISTS test CASCADE"); $c->exec("SET client_min_messages TO NOTICE"); -$c->exec("SET lc_messages TO 'C'"); +try { + $c->exec("SET lc_messages TO 'C'"); +} catch (pq\Exception $e) { + // do not die if we are not superuser +} $c->on(pq\Connection::EVENT_NOTICE, function($c, $notice) { echo "Got notice: $notice\n"; }); -- 2.39.5