Improve code coverage on a few stupid spots
This commit is contained in:
parent
235f93bdc4
commit
a04b8b44ff
@ -48,6 +48,7 @@ final class Connection_Manager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor to prevent multiple instances
|
* Private constructor to prevent multiple instances
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
private function __construct() {}
|
private function __construct() {}
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ final class Connection_Manager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Private clone method to prevent cloning
|
* Private clone method to prevent cloning
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
private function __clone() {}
|
private function __clone() {}
|
||||||
|
|
||||||
@ -62,6 +64,7 @@ final class Connection_Manager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure serialize/deseriaze doesn't work
|
* Make sure serialize/deseriaze doesn't work
|
||||||
|
* @codeCoverageIgnore
|
||||||
* @throws DomainException
|
* @throws DomainException
|
||||||
*/
|
*/
|
||||||
private function __wakeup()
|
private function __wakeup()
|
||||||
@ -80,10 +83,12 @@ final class Connection_Manager {
|
|||||||
public static function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
if (self::$instance === null)
|
if (self::$instance === null)
|
||||||
{
|
{
|
||||||
self::$instance = new self();
|
self::$instance = new self();
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
@ -212,12 +217,15 @@ final class Connection_Manager {
|
|||||||
*/
|
*/
|
||||||
private function create_dsn($dbtype, $params)
|
private function create_dsn($dbtype, $params)
|
||||||
{
|
{
|
||||||
|
// Add the driver type to the dsn
|
||||||
|
$dsn = ($dbtype !== 'firebird' && $dbtype !== 'sqlite')
|
||||||
|
? strtolower($dbtype).':'
|
||||||
|
: '';
|
||||||
|
|
||||||
if ($dbtype === 'firebird') $dsn = "{$params->host}:{$params->file}";
|
if ($dbtype === 'firebird') $dsn = "{$params->host}:{$params->file}";
|
||||||
elseif ($dbtype === 'sqlite') $dsn = $params->file;
|
elseif ($dbtype === 'sqlite') $dsn = $params->file;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dsn = strtolower($dbtype) . ':';
|
|
||||||
|
|
||||||
if ( ! empty($params->database))
|
if ( ! empty($params->database))
|
||||||
{
|
{
|
||||||
$dsn .= "dbname={$params->database}";
|
$dsn .= "dbname={$params->database}";
|
||||||
|
11
common.php
11
common.php
@ -5,6 +5,7 @@
|
|||||||
* Free Query Builder / Database Abstraction Layer
|
* Free Query Builder / Database Abstraction Layer
|
||||||
*
|
*
|
||||||
* @package Query
|
* @package Query
|
||||||
|
* @subpackage Core
|
||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2012 - 2014
|
* @copyright Copyright (c) 2012 - 2014
|
||||||
* @link https://github.com/aviat4ion/Query
|
* @link https://github.com/aviat4ion/Query
|
||||||
@ -15,8 +16,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Global functions that don't really fit anywhere else
|
* Global functions that don't really fit anywhere else
|
||||||
*
|
|
||||||
* @package Query
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -27,7 +26,6 @@ if ( ! function_exists('do_include'))
|
|||||||
* Bulk directory loading workaround for use
|
* Bulk directory loading workaround for use
|
||||||
* with array_map and glob
|
* with array_map and glob
|
||||||
*
|
*
|
||||||
* @subpackage Core
|
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -44,7 +42,6 @@ if ( ! function_exists('mb_trim'))
|
|||||||
/**
|
/**
|
||||||
* Multibyte-safe trim function
|
* Multibyte-safe trim function
|
||||||
*
|
*
|
||||||
* @subpackage Core
|
|
||||||
* @param string $string
|
* @param string $string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -59,7 +56,6 @@ if ( ! function_exists('mb_trim'))
|
|||||||
/**
|
/**
|
||||||
* Filter out db rows into one array
|
* Filter out db rows into one array
|
||||||
*
|
*
|
||||||
* @subpackage Core
|
|
||||||
* @param array $array
|
* @param array $array
|
||||||
* @param mixed $index
|
* @param mixed $index
|
||||||
* @return array
|
* @return array
|
||||||
@ -81,7 +77,6 @@ function db_filter($array, $index)
|
|||||||
/**
|
/**
|
||||||
* Connection function
|
* Connection function
|
||||||
*
|
*
|
||||||
* @subpackage Core
|
|
||||||
* @param mixed $params
|
* @param mixed $params
|
||||||
* @return Query_Builder
|
* @return Query_Builder
|
||||||
*/
|
*/
|
||||||
@ -99,7 +94,7 @@ function Query($params = '')
|
|||||||
// Otherwise, return a new connection
|
// Otherwise, return a new connection
|
||||||
return $cmanager->connect($params);
|
return $cmanager->connect($params);
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
// End of common.php
|
// End of common.php
|
@ -96,4 +96,9 @@ class PgSQLQBTest extends QBTest {
|
|||||||
|
|
||||||
$this->assertEqual($expected, $res);
|
$this->assertEqual($expected, $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testBackupStructure()
|
||||||
|
{
|
||||||
|
$this->assertEquals('', $this->db->util->backup_structure());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user