[Pkg-owncloud-commits] [php-sabredav] 184/220: Postgres Auth backend is now tested.
David Prévot
taffit at moszumanska.debian.org
Thu May 12 01:21:25 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 49b10dc0404606956f4dd2bfbd4e6365643e3dd0
Author: Evert Pot <me at evertpot.com>
Date: Wed Apr 27 18:53:52 2016 +0700
Postgres Auth backend is now tested.
---
tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php | 9 ++++++---
tests/Sabre/TestUtil.php | 13 +++++++++++++
tests/bootstrap.php | 2 +-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php
index c625b72..8bee7b9 100644
--- a/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php
+++ b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php
@@ -10,11 +10,14 @@ class PDOPgSqlTest extends AbstractPDOTest {
$pdo = \Sabre\TestUtil::getPgSqlDB();
if (!$pdo) $this->markTestSkipped('Could not connect to PgSql database');
- $sql = file_get_contents(__DIR__ . '/../../../../examples/sql/pgsql.users.sql');
+ $sql = file_get_contents(__DIR__ . '/../../../../../examples/sql/pgsql.users.sql');
$pdo->query("DROP TABLE IF EXISTS users");
- $pdo->query($sql);
- $pdo->query("INSERT INTO users (username,digesta1) VALUES ('user','hash','user at example.org','User')");
+ foreach(explode(';', $sql) as $statement) {
+ if(trim($statement) === '') continue;;
+ $pdo->query($statement); // Yup
+ }
+ $pdo->query("INSERT INTO users (username,digesta1) VALUES ('user','hash')");
return $pdo;
diff --git a/tests/Sabre/TestUtil.php b/tests/Sabre/TestUtil.php
index c82f301..9df9491 100644
--- a/tests/Sabre/TestUtil.php
+++ b/tests/Sabre/TestUtil.php
@@ -55,4 +55,17 @@ class TestUtil {
}
+ static function getPgSqlDB() {
+
+ //try {
+ $pdo = new \PDO(SABRE_PGSQLDSN);
+ $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
+ return $pdo;
+ //} catch (\PDOException $e) {
+ // return null;
+ //}
+
+ }
+
+
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index a1dee1a..1d9a242 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -20,7 +20,7 @@ $config = [
'SABRE_MYSQLDSN' => 'mysql:host=127.0.0.1;dbname=sabredav',
'SABRE_MYSQLUSER' => 'root',
'SABRE_MYSQLPASS' => '',
- 'SABRE_PGSQLDSN' => 'pgsql:host=localhost;dbname=sabredav',
+ 'SABRE_PGSQLDSN' => 'pgsql:host=localhost;dbname=sabredav;user=sabredav;password=sabredav',
];
if (file_exists(__DIR__ . '/config.user.php')) {
--
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