cakephp2-php8/app/controllers/tests_controller.php
pies 4a87a75332 - Two standard controllers -- PageController and TestsController
- Helpers for controllers -- each controller has it's own helper in the /app/helpers directory
- /logs and /modules directories
- The application runs just fine without /config/database.php if controllers don't ask for db access
- Changed the name of /public/dispatch.php to /public/index.php, it's nicer and more standard, won't you agree? Kamil's fix for no-mod_rewrite needs to be re-implemented
- Cleanups, fixes, and even one or two comments ;)

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@158 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-05-22 23:24:09 +00:00

43 lines
857 B
PHP

<?PHP
uses('test', 'folder', 'inflector');
class TestsController extends TestsHelper {
function test_all () {
$this->layout = 'test';
$tests_folder = new Folder('../tests');
$results = array();
$total_errors = 0;
foreach ($tests_folder->findRecursive('.*\.php') as $test) {
if (preg_match('/^(.+)\.php/i', basename($test), $r)) {
require_once($test);
$test_name = Inflector::Camelize($r[1]);
if (preg_match('/^(.+)Test$/i', $test_name, $r)) {
$module_name = $r[1];
}
else {
$module_name = $test_name;
}
$suite = new TestSuite($test_name);
$result = TestRunner::run($suite);
$total_errors += $result['errors'];
$results[] = array(
'name'=>$module_name,
'result'=>$result,
);
}
}
$this->set('success', !$total_errors);
$this->set('results', $results);
}
}
?>