2012-04-13 16:50:05 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Query
|
|
|
|
*
|
|
|
|
* Free Query Builder / Database Abstraction Layer
|
|
|
|
*
|
2012-04-20 13:17:39 -04:00
|
|
|
* @package Query
|
|
|
|
* @author Timothy J. Warren
|
2014-02-18 15:18:01 -05:00
|
|
|
* @copyright Copyright (c) 2012 - 2014
|
2012-04-13 16:50:05 -04:00
|
|
|
* @link https://github.com/aviat4ion/Query
|
2012-04-20 13:17:39 -04:00
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
2012-04-13 16:50:05 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parent Database Test Class
|
|
|
|
*/
|
2014-02-14 22:08:19 -05:00
|
|
|
abstract class DBTest extends Query_TestCase {
|
2012-04-13 16:50:05 -04:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
abstract public function testConnection();
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2012-04-13 16:50:05 -04:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
public function tearDown()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
$this->db = NULL;
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2012-04-13 16:50:05 -04:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testGetTables()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
$tables = $this->db->get_tables();
|
|
|
|
$this->assertTrue(is_array($tables));
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2012-04-13 16:50:05 -04:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testGetSystemTables()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
$tables = $this->db->get_system_tables();
|
|
|
|
|
|
|
|
$this->assertTrue(is_array($tables));
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2012-04-13 16:50:05 -04:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testCreateTransaction()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
$res = $this->db->beginTransaction();
|
|
|
|
$this->assertTrue($res);
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testBackupData()
|
2012-04-18 16:28:12 -04:00
|
|
|
{
|
2014-04-02 10:31:59 -04:00
|
|
|
$this->assertTrue(is_string($this->db->util->backup_data(array('create_delete', TRUE))));
|
2012-04-18 16:28:12 -04:00
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-05-09 13:54:38 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testGetColumns()
|
2012-05-09 13:54:38 -04:00
|
|
|
{
|
2014-02-18 19:29:58 -05:00
|
|
|
$cols = $this->db->get_columns('test');
|
2012-05-09 13:54:38 -04:00
|
|
|
$this->assertTrue(is_array($cols));
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2012-05-09 13:54:38 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2014-02-14 22:08:19 -05:00
|
|
|
public function testGetTypes()
|
2012-05-09 13:54:38 -04:00
|
|
|
{
|
|
|
|
$types = $this->db->get_types();
|
|
|
|
$this->assertTrue(is_array($types));
|
|
|
|
}
|
2014-02-25 13:47:35 -05:00
|
|
|
|
2014-04-07 16:49:49 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
public function testGetFKs()
|
|
|
|
{
|
|
|
|
$keys = $this->db->get_fks('create_test');
|
|
|
|
$this->assertTrue(is_array($keys));
|
|
|
|
}
|
|
|
|
|
2012-04-13 16:50:05 -04:00
|
|
|
}
|
|
|
|
// End of db_test.php
|