Adding Active Record to YAML conversion
[akelos.git] / test / unit.php
bloba8924e4526776431082abb4e764739697d6ea0fe
1 <?php
3 set_time_limit(0);
5 define('ALL_TESTS_CALL',true);
6 define('ALL_TESTS_RUNNER',true);
8 defined('AK_TEST_DATABASE_ON') ? null : define('AK_TEST_DATABASE_ON', true);
9 require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
11 require_once(AK_LIB_DIR.DS.'AkInstaller.php');
12 require_once(AK_APP_DIR.DS.'installers'.DS.'framework_installer.php');
13 $installer = new FrameworkInstaller();
14 $installer->uninstall();
15 $installer->install();
17 session_start();
19 $test = &new GroupTest('Unit tests for the Akelos Framework');
21 function load_tests($dir, &$test)
23 $d = dir($dir);
24 while (false !== ($entry = $d->read())) {
25 if($entry != '.' && $entry != '..' && $entry[0] != '.' && $entry[0] != '_') {
26 $entry = $dir.DS.$entry;
27 if(is_dir($entry)) {
28 load_tests($entry, $test);
29 } else {
30 if(!strstr(file_get_contents($entry), 'ALL_TESTS_RUNNER')){
31 $test->addTestFile($entry);
32 }else{
33 require_once($entry);
38 $d->close();
41 load_tests(AK_TEST_DIR.DS.'unit'.DS.'lib', $test);
43 if (TextReporter::inCli()) {
44 exit ($test->run(new TextReporter()) ? 0 : 1);
46 $test->run(new HtmlReporter());