[Pkg-owncloud-commits] [php-sabredav] 201/220: Skip unittests if postgres is older than 9.5
David Prévot
taffit at moszumanska.debian.org
Thu May 12 01:21:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 67cecf91d486a5e7955ca8efb0a41a8e30c5453c
Author: Evert Pot <me at evertpot.com>
Date: Fri Apr 29 13:39:23 2016 +0700
Skip unittests if postgres is older than 9.5
---
tests/Sabre/DAV/DbTestHelperTrait.php | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/Sabre/DAV/DbTestHelperTrait.php b/tests/Sabre/DAV/DbTestHelperTrait.php
index 98b86c6..cbe3b26 100644
--- a/tests/Sabre/DAV/DbTestHelperTrait.php
+++ b/tests/Sabre/DAV/DbTestHelperTrait.php
@@ -29,9 +29,12 @@ trait DbTestHelperTrait {
throw new \Exception('You must set the $driver public property');
}
- if (isset(DbCache::$cache[$this->driver])) {
- return DbCache::$cache[$this->driver];
- } else {
+ if (array_key_exists($this->driver, DbCache::$cache)) {
+ $pdo = DbCache::$cache[$this->driver];
+ if ($pdo === null) {
+ $this->markTestSkipped($this->driver . ' was not enabled, not correctly configured or of the wrong version');
+ }
+ return $pdo;
}
try {
@@ -46,6 +49,13 @@ trait DbTestHelperTrait {
break;
case 'pgsql' :
$pdo = new \PDO(SABRE_PGSQLDSN);
+ $version = $pdo->query('SELECT VERSION()')->fetchColumn();
+ preg_match('|([0-9\.]){5,}|', $version, $matches);
+ $version = $matches[0];
+ if (version_compare($version, '9.5.0', '<')) {
+ DbCache::$cache[$this->driver] = null;
+ $this->markTestSkipped('We require at least Postgres 9.5. This server is running ' . $version);
+ }
break;
@@ -91,7 +101,7 @@ trait DbTestHelperTrait {
if (trim($query) === '') {
continue;
}
-
+
$db->exec($query);
}
@@ -111,7 +121,7 @@ trait DbTestHelperTrait {
foreach ($tableNames as $tableName) {
$db->exec('DROP TABLE IF EXISTS ' . $tableName);
}
-
+
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list