Working on tests for the Model class
Fixed some bugs, got MySQL setup for Travis.
This commit is contained in:
parent
200988eecf
commit
51467a60f7
9 changed files with 209 additions and 52 deletions
|
@ -163,7 +163,6 @@ class Database extends Object
|
|||
|
||||
if (!isset($datasource['driver']))
|
||||
{
|
||||
var_Dump($datasource);
|
||||
throw new Exception('The specified datasource lacks a driver.');
|
||||
}
|
||||
|
||||
|
@ -315,7 +314,7 @@ class Database extends Object
|
|||
{
|
||||
$this->open();
|
||||
|
||||
if ($this->config->pickles['logging'] === true)
|
||||
if (isset($this->config->pickles['logging']) && $this->config->pickles['logging'])
|
||||
{
|
||||
$loggable_query = $sql;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class Log
|
|||
{
|
||||
$config = Config::getInstance();
|
||||
|
||||
if ($config->pickles['logging'] === true)
|
||||
if (isset($config->pickles['logging']) && $config->pickles['logging'])
|
||||
{
|
||||
$log_path = LOG_PATH . date('Y/m/d/', ($time == false ? time() : $time));
|
||||
|
||||
|
|
|
@ -333,12 +333,6 @@ class Model extends Object
|
|||
'is_deleted' => 'is_deleted',
|
||||
];
|
||||
|
||||
// Grabs the config columns if no columns are set
|
||||
if ($this->columns === null && isset($this->db->columns))
|
||||
{
|
||||
$this->columns = $this->db->columns;
|
||||
}
|
||||
|
||||
// Sets all but the `id` column to false
|
||||
if ($this->columns === false)
|
||||
{
|
||||
|
@ -594,7 +588,7 @@ class Model extends Object
|
|||
(count($this->input_parameters) == 0 ? null : $this->input_parameters)
|
||||
);
|
||||
|
||||
if (isset($partial_cache))
|
||||
if (isset($partial_cache) && count($this->records) > 1)
|
||||
{
|
||||
$records = array_merge($partial_cache, $this->records);
|
||||
|
||||
|
@ -639,7 +633,10 @@ class Model extends Object
|
|||
// @todo Move to Memcached extension and switch to use setMulti()
|
||||
foreach ($this->records as $record)
|
||||
{
|
||||
$this->cache->set(strtoupper($this->model) . '-' . $record['id'], $record);
|
||||
if (isset($record['id']))
|
||||
{
|
||||
$this->cache->set(strtoupper($this->model) . '-' . $record['id'], $record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1680,25 +1677,6 @@ class Model extends Object
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unescape String
|
||||
*
|
||||
* Assuming magic quotes is turned on, strips slashes from the string.
|
||||
*
|
||||
* @access protected
|
||||
* @param string $value string to be unescaped
|
||||
* @return string unescaped string
|
||||
*/
|
||||
protected function unescape($value)
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
{
|
||||
$value = stripslashes($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Field Values
|
||||
*
|
||||
|
|
|
@ -78,7 +78,7 @@ class Profiler
|
|||
public static function enabled(/* polymorphic */)
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config = $config->pickles['profiler'];
|
||||
$config = isset($config->pickles['profiler']) ? $config->pickles['profiler'] : false;
|
||||
|
||||
// Checks if we're set to boolean true
|
||||
if ($config === true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue