From: Jan Schneider Date: Fri, 3 Dec 2010 17:40:24 +0000 (+0100) Subject: Only try a json-encoded configuration if the env var content doesn't look like a... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=300892abb0f8f7cc04c38cab272b636396690c3e;p=horde.git Only try a json-encoded configuration if the env var content doesn't look like a path. --- diff --git a/framework/Db/test/Horde/Db/Adapter/MysqlSuite.php b/framework/Db/test/Horde/Db/Adapter/MysqlSuite.php index 4be4d0ff1..70686d9d7 100644 --- a/framework/Db/test/Horde/Db/Adapter/MysqlSuite.php +++ b/framework/Db/test/Horde/Db/Adapter/MysqlSuite.php @@ -62,7 +62,7 @@ class Horde_Db_Adapter_MysqlSuite extends PHPUnit_Framework_TestSuite public function getConnection() { $config = getenv('DB_ADAPTER_MYSQL_TEST_CONFIG'); - if ($config && !is_file($config)) { + if ($config && !is_dir(basename($config))) { $config = array_merge(array('host' => 'localhost', 'username' => '', 'password' => '', 'dbname' => 'test'), json_decode($config, true)); } else { if (!$config) { diff --git a/framework/Db/test/Horde/Db/Adapter/MysqliSuite.php b/framework/Db/test/Horde/Db/Adapter/MysqliSuite.php index 797467dfb..9395a721b 100644 --- a/framework/Db/test/Horde/Db/Adapter/MysqliSuite.php +++ b/framework/Db/test/Horde/Db/Adapter/MysqliSuite.php @@ -62,7 +62,7 @@ class Horde_Db_Adapter_MysqliSuite extends PHPUnit_Framework_TestSuite public function getConnection() { $config = getenv('DB_ADAPTER_MYSQLI_TEST_CONFIG'); - if ($config && !is_file($config)) { + if ($config && !is_dir(basename($config))) { $config = array_merge(array('host' => 'localhost', 'username' => '', 'password' => '', 'dbname' => 'test'), json_decode($config, true)); } else { if (!$config) { diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlSuite.php b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlSuite.php index 7b12340f8..286c47a03 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlSuite.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/MysqlSuite.php @@ -62,7 +62,7 @@ class Horde_Db_Adapter_Pdo_MysqlSuite extends PHPUnit_Framework_TestSuite public function getConnection() { $config = getenv('DB_ADAPTER_PDO_MYSQL_TEST_CONFIG'); - if ($config && !is_file($config)) { + if ($config && !is_dir(basename($config))) { $config = array_merge(array('host' => 'localhost', 'username' => '', 'password' => '', 'dbname' => 'test'), json_decode($config, true)); } else { if (!$config) { diff --git a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlSuite.php b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlSuite.php index 9837eabc7..71fdfa0b2 100644 --- a/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlSuite.php +++ b/framework/Db/test/Horde/Db/Adapter/Pdo/PgsqlSuite.php @@ -31,7 +31,8 @@ class Horde_Db_Adapter_Pdo_PgsqlSuite extends PHPUnit_Framework_TestSuite $suite = new self('Horde Framework - Horde_Db - PDO-PostgreSQL Adapter'); $skip = true; - if (extension_loaded('pdo') && in_array('pgsql', PDO::getAvailableDrivers())) { + if (extension_loaded('pdo') && + in_array('pgsql', PDO::getAvailableDrivers())) { try { self::$conn = $suite->getConnection(); $skip = false; @@ -62,10 +63,12 @@ class Horde_Db_Adapter_Pdo_PgsqlSuite extends PHPUnit_Framework_TestSuite public function getConnection() { - if (!is_null(self::$conn)) { return self::$conn; } + if (!is_null(self::$conn)) { + return self::$conn; + } $config = getenv('DB_ADAPTER_PDO_PGSQL_TEST_CONFIG'); - if ($config && !is_file($config)) { + if ($config && !is_dir(basename($config))) { $config = array_merge(array('username' => '', 'password' => '', 'dbname' => 'test'), json_decode($config, true)); } else { if (!$config) {