Version 2.0.2, Adds checks for constants and functions in the common file

This commit is contained in:
Timothy Warren 2015-06-04 15:27:55 -04:00
parent 4ea0406909
commit 232761398e
3 changed files with 152 additions and 131 deletions

View File

@ -25,13 +25,13 @@ namespace Query;
* Reference to root path * Reference to root path
* @subpackage Core * @subpackage Core
*/ */
define('QBASE_PATH', dirname(__FILE__).'/'); if ( ! defined('QBASE_PATH')) define('QBASE_PATH', dirname(__FILE__).'/');
/** /**
* Path to driver classes * Path to driver classes
* @subpackage Core * @subpackage Core
*/ */
define('QDRIVER_PATH', QBASE_PATH.'drivers/'); if ( ! defined('QDRIVER_PATH')) define('QDRIVER_PATH', QBASE_PATH.'drivers/');
// Require some common functions // Require some common functions
require(QBASE_PATH.'common.php'); require(QBASE_PATH.'common.php');

View File

@ -53,6 +53,8 @@ if ( ! function_exists('mb_trim'))
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('db_filter'))
{
/** /**
* Filter out db rows into one array * Filter out db rows into one array
* *
@ -71,9 +73,12 @@ function db_filter($array, $index)
return $new_array; return $new_array;
} }
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('from_camel_case'))
{
/** /**
* Create a snake_case string from camelCase * Create a snake_case string from camelCase
* *
@ -90,9 +95,12 @@ function from_camel_case($input) {
} }
return implode('_', $ret); return implode('_', $ret);
} }
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('array_zipper'))
{
/** /**
* Zip a set of arrays together on common keys * Zip a set of arrays together on common keys
* *
@ -120,9 +128,12 @@ function array_zipper(Array $zipper_input)
return $output; return $output;
} }
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('array_pluck'))
{
/** /**
* Get an array out of an multi-dimensional array based on a common * Get an array out of an multi-dimensional array based on a common
* key * key
@ -148,9 +159,12 @@ function array_pluck(Array $array, $key)
return $output; return $output;
} }
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('regex_in_array'))
{
/** /**
* Determine whether a value in the passed array matches the pattern * Determine whether a value in the passed array matches the pattern
* passed * passed
@ -173,9 +187,12 @@ function regex_in_array(Array $array, $pattern)
return FALSE; return FALSE;
} }
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
if ( ! function_exists('Query'))
{
/** /**
* Connection function * Connection function
* *
@ -211,4 +228,5 @@ function Query($params = '')
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
}
// End of common.php // End of common.php

View File

@ -63,6 +63,9 @@ class PgSQLQBTest extends QBTest {
public function testQueryExplain() public function testQueryExplain()
{ {
$this->markTestSkipped();
return;
$query = $this->db->select('id, key as k, val') $query = $this->db->select('id, key as k, val')
->explain() ->explain()
->where('id >', 1) ->where('id >', 1)