OpenSQLManager/tests/index.php

67 lines
1.6 KiB
PHP
Raw Normal View History

<?php
/**
* OpenSQLManager
*
* Free Database manager for Open Source Databases
*
* @author Timothy J. Warren
* @copyright Copyright (c) 2012
* @link https://github.com/aviat4ion/OpenSQLManager
2012-03-28 12:20:18 -04:00
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* Unit test bootstrap - Using php simpletest
*/
2012-04-10 08:52:51 -04:00
define('TEST_DIR', dirname(__FILE__).'/');
2012-03-23 15:29:34 -04:00
define('BASE_DIR', str_replace(basename(TEST_DIR), '', TEST_DIR).'/sys/');
define('DS', DIRECTORY_SEPARATOR);
2012-02-02 19:04:10 -05:00
2012-04-09 14:26:55 -04:00
// --------------------------------------------------------------------------
2012-02-02 19:04:10 -05:00
// Include simpletest
// it has to be set in your php path, or put in the tests folder
require_once('simpletest/autorun.php');
2012-04-12 14:06:00 -04:00
// Include db_drivers
require_once(BASE_DIR . 'db/autoload.php');
2012-02-02 19:04:10 -05:00
// Include core tests
2012-04-10 08:52:51 -04:00
array_map('do_include', glob(TEST_DIR . 'core/*.php'));
2012-04-04 10:52:45 -04:00
// Include required methods
2012-04-09 14:26:55 -04:00
array_map('do_include', glob(BASE_DIR . 'common/*.php'));
2012-02-02 19:04:10 -05:00
// Include db tests
// Load db classes based on capability
2012-03-23 15:29:34 -04:00
$src_path = BASE_DIR.'db/drivers/';
2012-04-10 08:52:51 -04:00
$test_path = TEST_DIR.'databases/';
foreach(pdo_drivers() as $d)
{
2012-03-28 12:20:18 -04:00
// PDO firebird isn't stable enough to
2012-03-06 21:07:34 -05:00
// bother, so skip it.
if ($d === 'firebird')
{
continue;
}
2012-04-09 15:41:48 -04:00
// Load by driver folder
$src_dir = "{$src_path}{$d}";
2012-03-28 12:20:18 -04:00
2012-04-09 15:41:48 -04:00
if(is_dir($src_dir))
{
2012-04-10 22:12:46 -04:00
require_once("{$test_path}{$d}/{$d}.php");
require_once("{$test_path}{$d}/{$d}-qb.php");
}
}
// Load Firebird if there is support
2012-03-19 12:20:51 -04:00
if(function_exists('fbird_connect'))
{
2012-04-09 15:24:10 -04:00
array_map('do_include', glob($src_path.'firebird/*.php'));
2012-04-10 22:12:46 -04:00
require_once("{$test_path}firebird/firebird.php");
require_once("{$test_path}firebird/firebird-qb.php");
}