<?php
/**
 * This file contains the full PMO Test Suite
 *
 * This file is part of the PhpMyObject project,
 * an Object-Relational Mapping (ORM) system.
 * 
 * For questions, help, comments, discussion, etc., please join our
 * forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770} 
 *
 * PhpMyProject is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see {@link http://www.gnu.org/licenses/}.
 *
 * @package			PhpMyObject
 * @subpackage 	PMO_Tests
 * @author			Louis Lapointe <laplix@gmail.com>
 * @link				http://pmo.developpez.com/
 * @since			PhpMyObject v0.15
 * @version			$Revision$
 * @copyright		Copyright (c) 2007-2008 Nicolas Boiteux 
 * @copyright		Copyright (c) 2008 Louis Lapointe
 * @license			GPLv3 {@link http://www.gnu.org/licenses/gpl}
 * @filesource
 */ 

/**
 * if this is not defined, test cases will be able to run
 * individually
 */
define('PMO_TEST_SUITE', TRUE);

/**
 * loads the configuration
 */
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.php');

/**
 * loads the Html reporter
 */
require_once(PMO_TESTS . DS . 'simpletest' . DS . 'PMO_HTMLReporter.php');

// create our test suite
$tests = new Testsuite('PMO Test Suite');

// add our tests
// each class must be tested by itself to garanty sanity

// 
// configuration and utilities
//
$tests->addTestFile('tests/PMO_MyConfig_Test.php');
//$tests->addTestFile('tests/PMO_MyArray_Test.php');
//$tests->addTestFile('tests/PMO_MyParser_Test.php');

//
// database drivers
// 
// TODO: I don't have PosgreSQL and I can't seem to
// make work the mysqli extension
//
$tests->addTestFile('tests/PMO_Dbms_Mysql_Test.php');
//$tests->addTestFile('tests/PMO_dbms_Mysqli_Test.php');
//$tests->addTestFile('tests/PMO_dbms_Pgsql_Test.php');
$tests->addTestFile('tests/PMO_Dbms_Sqlite_Test.php');
$tests->addTestFile('tests/PMO_Dbms_Pdo_Test.php');

// PMO_MyDbms tests with supported drivers
// 
// I got some unresolved bugs in these. So They'll have to wait a bit
//
$tests->addTestFile('tests/PMO_MyDbms_Mysql_Test.php');
//$tests->addTestFile('tests/PMO_MyDbms_Mysqli_Test.php');
//$tests->addTestFile('tests/PMO_MyDbms_Pgsql_Test.php');
//$tests->addTestFile('tests/PMO_MyDbms_Pdo_Mysql_Test.php');
$tests->addTestFile('tests/PMO_MyDbms_Pdo_Sqlite_Test.php');

//
// controller and objects
//
$tests->addTestFile('tests/PMO_MyObject_Test.php');
$tests->addTestFile('tests/PMO_MyController_Test.php');
//$tests->addTestFile('tests/PMO_MyTable_Test.php');
//$tests->addTestFile('tests/PMO_MyMap_Test.php');
$tests->addTestFile('tests/PMO_MyRequest_Test.php');



/**
 * Tells HTMLReporter what to show.
 * Usage: http://www.example/com/tests/tmp/PO_TestSuite.php?e=N
 * where N can be
 * none or  level=0: standard simpletest output
 *          level=1: shows subtotals for each test case
 *          level=2: shows all tests being performed
 * The level is remembered through a cookie for 30 days.
 */
$level = '';
if (isset($_COOKIE['testLevel'])) {
	$level = $_COOKIE['testLevel'];
}
elseif (isset($_GET['level'])) {
	$level = $_GET['level'];
	setcookie('testLevel', $level, time()+60*60*24*30);
}

// run the tests
$tests->run(new PMO_HTMLReporter($level));
?>
