[Pkg-owncloud-commits] [php-sabredav] 182/220: Few postgres tweaks

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 cd75a47386418676c591b1b09a10d97004515f1d
Author: Evert Pot <me at evertpot.com>
Date:   Sat Apr 9 22:05:56 2016 -0400

    Few postgres tweaks
---
 tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php  | 18 +++++-------------
 tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php  | 25 +++++++++++++++++++++++++
 tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php |  5 +++--
 tests/bootstrap.php                            |  3 ++-
 4 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php b/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php
index 8de2be6..f391557 100644
--- a/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php
+++ b/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php
@@ -11,20 +11,12 @@ class PDOMySQLTest extends AbstractPDOTest {
         if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or not properly configured');
         $pdo = \Sabre\TestUtil::getMySQLDB();
         if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database');
+
+        $sql = file_get_contents(__DIR__ . '/../../../../examples/sql/mysql.users.sql');
+
         $pdo->query("DROP TABLE IF EXISTS users");
-        $pdo->query(<<<SQL
-create table users (
-  id integer unsigned not null primary key auto_increment,
-  username varchar(50),
-  digesta1 varchar(32),
-  email varchar(80),
-  displayname varchar(80),
-  unique(username)
-)
-SQL
-        );
-
-        $pdo->query("INSERT INTO users (username,digesta1,email,displayname) VALUES ('user','hash','user at example.org','User')");
+        $pdo->query($sql);
+        $pdo->query("INSERT INTO users (username,digesta1) VALUES ('user','hash','user at example.org','User')");
 
         return $pdo;
 
diff --git a/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php
new file mode 100644
index 0000000..9d4585c
--- /dev/null
+++ b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Sabre\DAV\Auth\Backend;
+
+require_once 'Sabre/TestUtil.php';
+
+class PDOPgSqlTest extends AbstractPDOTest {
+
+    function getPDO() {
+
+        if (!SABRE_HASPGSQL) $this->markTestSkipped('PGSQL driver is not available, or not properly configured');
+        $pdo = \Sabre\TestUtil::getPgSqlDB();
+        if (!$pdo) $this->markTestSkipped('Could not connect to PgSql database');
+
+        $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')");
+
+        return $pdo;
+
+    }
+
+}
diff --git a/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php b/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php
index 6736afc..f2e56c7 100644
--- a/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php
+++ b/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php
@@ -18,8 +18,9 @@ class PDOSqliteTest extends AbstractPDOTest {
         if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available');
         $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/pdobackend');
         $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
-        $pdo->query('CREATE TABLE users (username TEXT, digesta1 TEXT, email VARCHAR(80), displayname VARCHAR(80))');
-        $pdo->query('INSERT INTO users VALUES ("user","hash","user at example.org","User")');
+        $sql = file_get_contents(__DIR__ . '/../../../../../examples/sql/sqlite.users.sql');
+        $pdo->query($sql);
+        $pdo->query('INSERT INTO users (username, digesta1) VALUES ("user","hash")');
 
         return $pdo;
 
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index ad05ba4..a1dee1a 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -16,7 +16,8 @@ $config = [
     'SABRE_TEMPDIR'   => dirname(__FILE__) . '/temp/',
     'SABRE_HASSQLITE' => in_array('sqlite', PDO::getAvailableDrivers()),
     'SABRE_HASMYSQL'  => in_array('mysql', PDO::getAvailableDrivers()),
-    'SABRE_MYSQLDSN'  => 'mysql:host=127.0.0.1;dbname=sabredav_test',
+    'SABRE_HASPGSQL'  => in_array('pgsql', PDO::getAvailableDrivers()),
+    'SABRE_MYSQLDSN'  => 'mysql:host=127.0.0.1;dbname=sabredav',
     'SABRE_MYSQLUSER' => 'root',
     'SABRE_MYSQLPASS' => '',
     'SABRE_PGSQLDSN'  => 'pgsql:host=localhost;dbname=sabredav',

-- 
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