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
|
2012-04-13 16:50:05 -04:00
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
abstract class DBTest extends UnitTestCase {
|
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
abstract public function TestConnection();
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
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;
|
|
|
|
}
|
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 TestGetTables()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
if (empty($this->db)) return;
|
|
|
|
|
|
|
|
$tables = $this->db->get_tables();
|
|
|
|
$this->assertTrue(is_array($tables));
|
|
|
|
}
|
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 TestGetSystemTables()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
if (empty($this->db)) return;
|
|
|
|
|
|
|
|
$tables = $this->db->get_system_tables();
|
|
|
|
|
|
|
|
$this->assertTrue(is_array($tables));
|
|
|
|
}
|
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 TestCreateTransaction()
|
2012-04-13 16:50:05 -04:00
|
|
|
{
|
|
|
|
if (empty($this->db)) return;
|
|
|
|
|
|
|
|
$res = $this->db->beginTransaction();
|
|
|
|
$this->assertTrue($res);
|
|
|
|
}
|
2012-04-18 16:28:12 -04:00
|
|
|
|
2012-04-24 14:00:44 -04:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
public function TestBackupData()
|
2012-04-18 16:28:12 -04:00
|
|
|
{
|
|
|
|
$this->assertTrue(is_string($this->db->util->backup_data()));
|
|
|
|
}
|
2012-05-09 13:54:38 -04:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
public function TestGetColumns()
|
|
|
|
{
|
|
|
|
$cols = $this->db->get_columns('create_test');
|
|
|
|
$this->assertTrue(is_array($cols));
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
public function TestGetTypes()
|
|
|
|
{
|
|
|
|
$types = $this->db->get_types();
|
|
|
|
$this->assertTrue(is_array($types));
|
|
|
|
}
|
2012-04-13 16:50:05 -04:00
|
|
|
}
|
|
|
|
// End of db_test.php
|