From: Michael Wallner Date: Fri, 15 Jan 2021 12:25:11 +0000 (+0100) Subject: adapt some tests for non-superuser environments X-Git-Tag: v2.2.0~11 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6f6cead21b6d78b9d0dc6d0ea30e417ec72aced4;p=m6w6%2Fext-pq adapt some tests for non-superuser environments --- 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"; });