public function __construct($run_from_commandline = false) { if ($run_from_commandline) { $this->init_constants(); echo "Bootstrapping Testing System by Testing Autoloader...\n"; $bootstrap_test = $this->bootstrap_test_autoloader(); if ($bootstrap_test->tests_failed) { echo "Bootstrap Fail, stopping subsequent tests.\n"; echo "=== DEBUG ===\n"; echo $bootstrap_test->output; exit; } else { echo "Bootstrap Pass, continuing...\n"; } echo "Running TethAutoloader::init()\n"; TethAutoloader::init(); echo "Running TethAutoloader::register_classes()\n"; TethAutoloader::register_classes(array(SITE_DIR)); $this->test_classes = $this->scan_classes(TethAutoloader::$classes); echo "Found " . count($this->test_classes) . " test classes ...\n"; $this->run_tests(); } }
<?php define("SITE_DIR", realpath(dirname(__FILE__) . "/../") . "/"); require SITE_DIR . '/teth/TethAutoloader.php'; TethAutoloader::init(); TethAutoloader::go();
public function go() { $ret = true; $GLOBALS['application_has_run'] = false; $application = Config::$settings['classes']['application']; $backup_components = TethAutoloader::$components; $dir = realpath(dirname(__FILE__) . "/../../"); Config::$settings['classes']['application'] = array('class' => 'TestExampleClass', 'component' => false, 'module' => 'teth-test', 'base' => $dir); TethAutoloader::$classes['TestExampleClass'] = $dir . "/teth-test/TestExampleClass.php"; TethAutoloader::go(); if (!$GLOBALS['application_has_run']) { $this->results['go']['run'] = $ret = false; } else { $this->results['go']['run'] = true; } Config::$settings['classes']['application'] = $application; unset(TethAutoloader::$classes['TestExampleClass']); TethAutoloader::$components = $backup_components; return $ret; }