Query/tests/index.php

70 lines
1.7 KiB
PHP
Raw Normal View History

2012-03-15 09:25:18 -04:00
<?php
/**
* Query
*
* Free Query Builder / Database Abstraction Layer
*
2012-04-20 13:17:39 -04:00
* @package Query
* @author Timothy J. Warren
2013-01-02 14:26:42 -05:00
* @copyright Copyright (c) 2012 - 2013
2012-03-15 09:25:18 -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-03-15 09:25:18 -04:00
*/
// --------------------------------------------------------------------------
/**
* Unit test bootstrap - Using php simpletest
*/
2012-04-30 16:06:06 -04:00
define('QTEST_DIR', dirname(__FILE__));
define('QBASE_DIR', str_replace(basename(QTEST_DIR), '', QTEST_DIR));
define('QDS', DIRECTORY_SEPARATOR);
2012-03-15 09:25:18 -04:00
// Include simpletest
2013-12-06 23:37:43 -05:00
// it has to be in the tests folder
2012-03-15 09:25:18 -04:00
require_once('simpletest/autorun.php');
2013-12-06 23:37:43 -05:00
// Require composer items, if they exist
if (is_dir(QBASE_DIR.'/vendor/'))
{
require_once(QBASE_DIR.'/vendor/autoload.php');
}
2012-04-10 14:06:34 -04:00
// Include db classes
2012-04-30 16:06:06 -04:00
require_once(QBASE_DIR . 'autoload.php');
2012-03-15 09:25:18 -04:00
// Require base testing classes
2012-04-30 16:06:06 -04:00
require_once(QTEST_DIR . '/core/core.php');
require_once(QTEST_DIR . '/core/db_test.php');
2012-08-02 11:59:11 -04:00
require_once(QTEST_DIR . '/core/db_qp_test.php');
2012-04-30 16:06:06 -04:00
require_once(QTEST_DIR . '/core/db_qb_test.php');
2012-03-15 09:25:18 -04:00
// Include db tests
// Load db classes based on capability
2012-04-30 16:06:06 -04:00
$src_path = QBASE_DIR.'drivers/';
$test_path = QTEST_DIR.'/databases/';
2012-03-15 09:25:18 -04:00
foreach(PDO::getAvailableDrivers() as $d)
2012-03-15 09:25:18 -04:00
{
2012-05-29 16:34:45 -04:00
// PDO firebird isn't stable enough to
2012-03-15 09:25:18 -04:00
// bother, so skip it.
if ($d === 'firebird')
{
continue;
}
2012-04-17 15:05:36 -04:00
$src_dir = "{$test_path}{$d}";
2012-05-29 16:34:45 -04:00
if (is_dir($src_dir))
2012-03-15 09:25:18 -04:00
{
2012-04-11 11:53:18 -04:00
require_once("{$test_path}{$d}/{$d}.php");
require_once("{$test_path}{$d}/{$d}-qb.php");
2012-03-15 09:25:18 -04:00
}
}
// Load Firebird if there is support
2012-05-29 16:34:45 -04:00
if (function_exists('fbird_connect') && ! ($var = getenv('CI')))
2012-03-15 09:25:18 -04:00
{
2012-04-11 11:53:18 -04:00
require_once("{$test_path}/firebird/firebird.php");
require_once("{$test_path}/firebird/firebird-qb.php");
2012-03-15 09:25:18 -04:00
}