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
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __construct() {}
|
||||
|
||||
@ -55,6 +56,7 @@ final class Connection_Manager {
|
||||
|
||||
/**
|
||||
* Private clone method to prevent cloning
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __clone() {}
|
||||
|
||||
@ -62,6 +64,7 @@ final class Connection_Manager {
|
||||
|
||||
/**
|
||||
* Make sure serialize/deseriaze doesn't work
|
||||
* @codeCoverageIgnore
|
||||
* @throws DomainException
|
||||
*/
|
||||
private function __wakeup()
|
||||
@ -80,10 +83,12 @@ final class Connection_Manager {
|
||||
public static function get_instance()
|
||||
{
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if (self::$instance === null)
|
||||
{
|
||||
self::$instance = new self();
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
@ -212,12 +217,15 @@ final class Connection_Manager {
|
||||
*/
|
||||
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}";
|
||||
elseif ($dbtype === 'sqlite') $dsn = $params->file;
|
||||
else
|
||||
{
|
||||
$dsn = strtolower($dbtype) . ':';
|
||||
|
||||
if ( ! empty($params->database))
|
||||
{
|
||||
$dsn .= "dbname={$params->database}";
|
||||
|
11
common.php
11
common.php
@ -5,6 +5,7 @@
|
||||
* Free Query Builder / Database Abstraction Layer
|
||||
*
|
||||
* @package Query
|
||||
* @subpackage Core
|
||||
* @author Timothy J. Warren
|
||||
* @copyright Copyright (c) 2012 - 2014
|
||||
* @link https://github.com/aviat4ion/Query
|
||||
@ -15,8 +16,6 @@
|
||||
|
||||
/**
|
||||
* 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
|
||||
* with array_map and glob
|
||||
*
|
||||
* @subpackage Core
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
@ -44,7 +42,6 @@ if ( ! function_exists('mb_trim'))
|
||||
/**
|
||||
* Multibyte-safe trim function
|
||||
*
|
||||
* @subpackage Core
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
@ -59,7 +56,6 @@ if ( ! function_exists('mb_trim'))
|
||||
/**
|
||||
* Filter out db rows into one array
|
||||
*
|
||||
* @subpackage Core
|
||||
* @param array $array
|
||||
* @param mixed $index
|
||||
* @return array
|
||||
@ -81,7 +77,6 @@ function db_filter($array, $index)
|
||||
/**
|
||||
* Connection function
|
||||
*
|
||||
* @subpackage Core
|
||||
* @param mixed $params
|
||||
* @return Query_Builder
|
||||
*/
|
||||
@ -99,7 +94,7 @@ function Query($params = '')
|
||||
// Otherwise, return a new connection
|
||||
return $cmanager->connect($params);
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// End of common.php
|
@ -96,4 +96,9 @@ class PgSQLQBTest extends QBTest {
|
||||
|
||||
$this->assertEqual($expected, $res);
|
||||
}
|
||||
|
||||
public function testBackupStructure()
|
||||
{
|
||||
$this->assertEquals('', $this->db->util->backup_structure());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user