[Pkg-owncloud-commits] [php-sabredav] 198/220: Fixed PropertyStorage tests.

David Prévot taffit at moszumanska.debian.org
Thu May 12 01:21:27 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 22d16e88bf729144463131cc67485e3b578e5434
Author: Evert Pot <me at evertpot.com>
Date:   Thu Apr 28 16:17:33 2016 +0700

    Fixed PropertyStorage tests.
---
 .../PropertyStorage/Backend/AbstractPDOTest.php    |  5 +++-
 .../DAV/PropertyStorage/Backend/PDOMysqlTest.php   | 23 +----------------
 .../DAV/PropertyStorage/Backend/PDOPgSqlTest.php   | 25 +------------------
 .../DAV/PropertyStorage/Backend/PDOSqliteTest.php  | 29 +---------------------
 4 files changed, 7 insertions(+), 75 deletions(-)

diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php
index 4d25650..a2b9987 100644
--- a/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php
+++ b/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php
@@ -11,12 +11,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
 
     use \Sabre\DAV\DbTestHelperTrait;
 
-
     function getBackend() {
 
         $this->dropTables('propertystorage');
         $this->createSchema('propertystorage');
 
+        $pdo = $this->getPDO();
+
+        $pdo->exec("INSERT INTO propertystorage (path, name, valuetype, value) VALUES ('dir', '{DAV:}displayname', 1, 'Directory')");
+
         return new PDO($this->getPDO());
 
     }
diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php
index 81a64a4..b92b034 100644
--- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php
+++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php
@@ -4,27 +4,6 @@ namespace Sabre\DAV\PropertyStorage\Backend;
 
 class PDOMysqlTest extends AbstractPDOTest {
 
-    function getPDO() {
-
-        $pdo = \Sabre\TestUtil::getMySQLDB();
-        if (!$pdo) $this->markTestSkipped('MySQL is not enabled');
-
-        $setupSql = file_get_contents(__DIR__ . '/../../../../../examples/sql/mysql.propertystorage.sql');
-        // Sloppy multi-query, but it works
-        $setupSql = explode(';', $setupSql);
-
-        $pdo->exec('DROP TABLE IF EXISTS propertystorage');
-
-        foreach ($setupSql as $sql) {
-
-            if (!trim($sql)) continue;
-            $pdo->exec($sql);
-
-        }
-        $pdo->exec('INSERT INTO propertystorage (path, name, value, valuetype) VALUES ("dir", "{DAV:}displayname", "Directory", 1)');
-
-        return $pdo;
-
-    }
+    public $driver = 'mysql';
 
 }
diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php
index a579b9c..616c2e6 100644
--- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php
+++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php
@@ -4,29 +4,6 @@ namespace Sabre\DAV\PropertyStorage\Backend;
 
 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('Pos is not enabled');
-
-
-        $setupSql = file_get_contents(__DIR__ . '/../../../../../examples/sql/pgsql.propertystorage.sql');
-        // Sloppy multi-query, but it works
-        $setupSql = explode(';', $setupSql);
-
-        $pdo->exec('DROP TABLE IF EXISTS propertystorage');
-
-        foreach ($setupSql as $sql) {
-
-            if (!trim($sql)) continue;
-            $pdo->exec($sql);
-
-        }
-        $pdo->exec("INSERT INTO propertystorage (path, name, value, valuetype) VALUES ('dir', '{DAV:}displayname', 'Directory', 1)");
-
-        return $pdo;
-
-    }
+    public $driver = 'pgsql';
 
 }
diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php
index 2355e1c..20a6a09 100644
--- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php
+++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php
@@ -4,33 +4,6 @@ namespace Sabre\DAV\PropertyStorage\Backend;
 
 class PDOSqliteTest extends AbstractPDOTest {
 
-    function getPDO() {
-
-        $pdo = \Sabre\TestUtil::getSqliteDB();
-        if (!$pdo) $this->markTestSkipped('Sqlite is not enabled');
-
-        $setupSql = file_get_contents(__DIR__ . '/../../../../../examples/sql/sqlite.propertystorage.sql');
-        // Sloppy multi-query, but it works
-        $setupSql = explode(';', $setupSql);
-
-        $pdo->exec('DROP TABLE IF EXISTS propertystorage');
-
-        foreach ($setupSql as $sql) {
-
-            if (!trim($sql)) continue;
-            $pdo->exec($sql);
-
-        }
-        $pdo->exec('INSERT INTO propertystorage (path, name, value, valuetype) VALUES ("dir", "{DAV:}displayname", "Directory", 1)');
-
-        return $pdo;
-
-    }
-
-    function tearDown() {
-
-        \Sabre\TestUtil::clearTempDir();
-
-    }
+    public $driver = 'sqlite';
 
 }

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